[Mesa-dev] [PATCH] gallium: Fix uninitialized variable warning in compute test.

Eric Anholt eric at anholt.net
Mon Nov 26 21:13:16 UTC 2018


The compiler doesn't know that ny != 0, so x might be uninitialized for
the printf at the end.
---
 src/gallium/tests/trivial/compute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
index afe5d3e9f2be..20e5a4f140c9 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -240,7 +240,7 @@ static void check_tex(struct context *ctx, int slot,
                   util_format_get_nblocksy(tex->format, tex->height0));
         struct pipe_transfer *xfer;
         char *map;
-        int x, y, i;
+        int x = 0, y, i;
         int err = 0;
 
         if (!check)
-- 
2.20.0.rc1



More information about the mesa-dev mailing list