Mesa (master): glsl: Initialize source_chan in opt_copy_propagation_elements.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Sep 4 00:24:17 UTC 2014


Module: Mesa
Branch: master
Commit: 5ced83ee1561553d9eba831fa356bf63cc214447
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ced83ee1561553d9eba831fa356bf63cc214447

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Aug 28 15:33:56 2014 -0700

glsl: Initialize source_chan in opt_copy_propagation_elements.

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 at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/opt_copy_propagation_elements.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp
index f5f59b7..f131894 100644
--- a/src/glsl/opt_copy_propagation_elements.cpp
+++ b/src/glsl/opt_copy_propagation_elements.cpp
@@ -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)




More information about the mesa-commit mailing list