[Mesa-dev] [PATCH v2] nouveau: Silence GCC maybe-uninitialized warnings.

Vinson Lee vlee at freedesktop.org
Sat Mar 7 00:08:21 PST 2015


nouveau_compiler.c: In function ‘main’:
nouveau_compiler.c:216:27: warning: ‘code’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       printf("%08x ", code[i / 4]);
                           ^
nouveau_compiler.c:215:4: warning: ‘size’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    for (i = 0; i < size; i += 4) {
    ^

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/gallium/drivers/nouveau/nouveau_compiler.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 8660498..c31885f 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -128,6 +128,8 @@ nouveau_codegen(int chipset, int type, struct tgsi_token tokens[],
    ret = nv50_ir_generate_code(&info);
    if (ret) {
       _debug_printf("Error compiling program: %d\n", ret);
+      *size = 0;
+      *code = NULL;
       return ret;
    }
 
-- 
2.3.1



More information about the mesa-dev mailing list