[Piglit] [PATCH] gl-1.0-readpixsanity: Fix GCC maybe-uninitialized warnings.
Vinson Lee
vlee at freedesktop.org
Tue Jan 6 16:35:45 PST 2015
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
More information about the Piglit
mailing list