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

Ilia Mirkin imirkin at alum.mit.edu
Fri Mar 6 23:28:08 PST 2015


On Sat, Mar 7, 2015 at 2:23 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> 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) {
>     ^

I don't see how this can happen. Sounds like a bogus warning. The
solution isn't to munge the code to please a broken compiler... feel
free to stick a -Wno-maybe-uninitialized in -- that warning is mostly
bs anyways.

Or, if that _is_ actually possible, the fix will be in the
nouveau_codegen/nv30_codegen functions.

>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/gallium/drivers/nouveau/nouveau_compiler.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
> index 8660498..ca128b5 100644
> --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
> +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
> @@ -144,7 +144,7 @@ main(int argc, char *argv[])
>     const char *filename = NULL;
>     FILE *f;
>     char text[65536] = {0};
> -   unsigned size, *code;
> +   unsigned size = 0, *code = NULL;
>
>     for (i = 1; i < argc; i++) {
>        if (!strcmp(argv[i], "-a"))
> --
> 2.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list