glsl: Initialize source_chan in opt_copy_propagation_elements.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 28 Aug 2014 22:33:56 +0000 (15:33 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 4 Sep 2014 00:25:56 +0000 (17:25 -0700)
Previously, if chans < 4, we passed uninitialized stack garbage to the
ir_swizzle constructor for the excess components.  Thankfully, it
ignores that data, as it's unnecessary, so no harm actually comes of it.

However, it's obviously better to initialize it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/opt_copy_propagation_elements.cpp

index f5f59b7d34a6a7e7a0b76161f371b9a8403f6f06..f131894608de4b68e6574929d40b48483bb38238 100644 (file)
@@ -207,7 +207,7 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir)
    int swizzle_chan[4];
    ir_dereference_variable *deref_var;
    ir_variable *source[4] = {NULL, NULL, NULL, NULL};
-   int source_chan[4];
+   int source_chan[4] = {0, 0, 0, 0};
    int chans;
 
    if (!*ir)