nir: Fix uninitialized 'progress' variable in nir_lower_system_values.
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 2 Oct 2015 17:39:39 +0000 (10:39 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 2 Oct 2015 17:44:28 +0000 (10:44 -0700)
Commit 0a1adaf11d051b71b4c46aabee2e5342f2d6aef3 (nir: Report progress
from nir_lower_system_values().) introduced a bug caught by Valgrind:

==823== Conditional jump or move depends on uninitialised value(s)
==823==    at 0xB09020C: convert_block (nir_lower_system_values.c:68)
==823==    by 0xB079FB8: foreach_cf_node (nir.c:1310)
==823==    by 0xB07A0AF: nir_foreach_block (nir.c:1336)
==823==    by 0xB09026B: convert_impl (nir_lower_system_values.c:79)
...
==823==  Uninitialised value was created by a stack allocation
==823==    at 0xB090249: convert_impl (nir_lower_system_values.c:76)

which is trivially fixed by initializing progress.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir_lower_system_values.c

index d77bb2f821304e871a924b5c4efc14dca4714e33..21904f81b97828cc9a75aca3b42bf8bd7dd2b130 100644 (file)
@@ -74,7 +74,7 @@ convert_block(nir_block *block, void *state)
 static bool
 convert_impl(nir_function_impl *impl)
 {
-   bool progress;
+   bool progress = false;
 
    nir_foreach_block(impl, convert_block, &progress);
    nir_metadata_preserve(impl, nir_metadata_block_index |