[Piglit] [PATCH] gl-1.0-readpixsanity: Fix GCC maybe-uninitialized warnings.

Anuj Phogat anuj.phogat at gmail.com
Wed Jan 7 11:07:00 PST 2015


On Tue, Jan 6, 2015 at 4:35 PM, Vinson Lee <vlee at freedesktop.org> wrote:
> readpix.c: In function 'check_stencil':
> readpix.c:325:3: warning: 'expected' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    printf("\t\tExpected %i; got %i.\n",
>    ^
> readpix.c:326:19: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
>     expected, buf[y*w + x]);
>                    ^
> readpix.c:326:22: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
>     expected, buf[y*w + x]);
>                       ^
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/spec/gl-1.0/readpix.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/spec/gl-1.0/readpix.c b/tests/spec/gl-1.0/readpix.c
> index e43a218..9597706 100644
> --- a/tests/spec/gl-1.0/readpix.c
> +++ b/tests/spec/gl-1.0/readpix.c
> @@ -283,12 +283,12 @@ random_bits(unsigned int bits)
>  bool
>  check_stencil(void)
>  {
> -       int i, x, y;
> +       int i, x = 0, y = 0;
>         bool pass = true;
>         const int w = piglit_width;
>         const int h = piglit_height;
>         GLuint *buf = malloc(h * w * sizeof *buf);
> -       GLuint expected;
> +       GLuint expected = 0;
>         GLint sbits;
>         glGetIntegerv(GL_STENCIL_BITS, &sbits);
>         pass &= piglit_check_gl_error(GL_NO_ERROR);
> --
> 2.2.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list