[Piglit] [PATCH] gl-1.0-blend-func: Fix GCC maybe-uninitialized warnings.
Brian Paul
brianp at vmware.com
Wed Jan 7 08:04:17 PST 2015
On 01/06/2015 05:28 PM, Vinson Lee wrote:
> blend.c: In function 'run_factor_set':
> blend.c:503:42: warning: 'df[3]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[3] = CLAMP(src[3] * sf[3] + dst[3] * df[3], 0.0f, 1.0f);
> ^
> blend.c:255:15: note: 'df[3]' was declared here
> float sf[4], df[4];
> ^
> blend.c:503:25: warning: 'sf[3]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[3] = CLAMP(src[3] * sf[3] + dst[3] * df[3], 0.0f, 1.0f);
> ^
> blend.c:255:8: note: 'sf[3]' was declared here
> float sf[4], df[4];
> ^
> blend.c:485:25: warning: 'df[2]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[2] = CLAMP(dst[2] * df[2] - src[2] * sf[2], 0.0f, 1.0f);
> ^
> blend.c:255:15: note: 'df[2]' was declared here
> float sf[4], df[4];
> ^
> blend.c:484:25: warning: 'df[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[1] = CLAMP(dst[1] * df[1] - src[1] * sf[1], 0.0f, 1.0f);
> ^
> blend.c:255:15: note: 'df[1]' was declared here
> float sf[4], df[4];
> ^
> blend.c:473:42: warning: 'df[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[0] = CLAMP(src[0] * sf[0] + dst[0] * df[0], 0.0f, 1.0f);
> ^
> blend.c:255:15: note: 'df[0]' was declared here
> float sf[4], df[4];
> ^
> blend.c:485:42: warning: 'sf[2]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[2] = CLAMP(dst[2] * df[2] - src[2] * sf[2], 0.0f, 1.0f);
> ^
> blend.c:255:8: note: 'sf[2]' was declared here
> float sf[4], df[4];
> ^
> blend.c:484:42: warning: 'sf[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[1] = CLAMP(dst[1] * df[1] - src[1] * sf[1], 0.0f, 1.0f);
> ^
> blend.c:255:8: note: 'sf[1]' was declared here
> float sf[4], df[4];
> ^
> blend.c:473:25: warning: 'sf[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
> dst[0] = CLAMP(src[0] * sf[0] + dst[0] * df[0], 0.0f, 1.0f);
> ^
> blend.c:255:8: note: 'sf[0]' was declared here
> float sf[4], df[4];
> ^
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> tests/spec/gl-1.0/blend.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
> index 9fe345c..34a79b4 100644
> --- a/tests/spec/gl-1.0/blend.c
> +++ b/tests/spec/gl-1.0/blend.c
> @@ -252,7 +252,8 @@ apply_blend(GLenum src_factor_rgb, GLenum src_factor_a,
> float* dst, const float* src,
> const GLfloat constant_color[4])
> {
> - float sf[4], df[4];
> + float sf[4] = { 0 };
> + float df[4] = { 0 };
>
> if (op_rgb != GL_MIN && op_rgb != GL_MAX) {
> /* Src RGB term */
>
For all three patches: Reviewed-by: Brian Paul <brianp at vmware.com>
More information about the Piglit
mailing list