[Mesa-dev] [PATCH 2/5] Fixup program_parse.y to avoid uninitialized $$

Eric Anholt eric at anholt.net
Wed Feb 27 16:58:38 PST 2013


From: Paul Berry <stereotype441 at gmail.com>

Without this patch, $$.negate, $$.rgba_valid, and $$.xyzw_valid take
on garbage values.  At the moment this problem is benign (the garbage
values happen to be zero), but in my experiments executing GL
operations on a background thread, the garbage values change, leading
to piglit failures.

Reviewed-by: Eric Anholt <eric at anholt.net>
---
 src/mesa/program/program_parse.y |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 025b547..baa436b 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -709,6 +709,7 @@ extSwizSel: INTEGER
 	   }
 
 	   $$.swz = ($1 == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
+           $$.negate = 0;
 
 	   /* 0 and 1 are valid for both RGBA swizzle names and XYZW
 	    * swizzle names.
@@ -728,6 +729,10 @@ extSwizSel: INTEGER
 	   s = $1[0];
 	   free($1);
 
+           $$.rgba_valid = 0;
+           $$.xyzw_valid = 0;
+           $$.negate = 0;
+
 	   switch (s) {
 	   case 'x':
 	      $$.swz = SWIZZLE_X;
-- 
1.7.10.4



More information about the mesa-dev mailing list