Patchwork vect_shuffle fixups: c parser

login
register
mail settings
Submitter Richard Henderson
Date Oct. 4, 2011, 9:06 p.m.
Message ID <4E8B756E.8080909@redhat.com>
Download mbox | patch
Permalink /patch/117694/
State New
Headers show

Comments

Richard Henderson - Oct. 4, 2011, 9:06 p.m.
Most three-argument tests failed due, in part, to the two_arguments variable being uninitialized.

Committed.


r~
* c-typeck.c (c_build_vec_shuffle_expr): Fix uninitialized variable.
	Avoid save_expr unless two_arguments.

Patch

diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 96ef4a3..e7528a7 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2859,10 +2859,10 @@  build_function_call_vec (location_t loc, tree function, VEC(tree,gc) *params,
 tree
 c_build_vec_shuffle_expr (location_t loc, tree v0, tree v1, tree mask)
 {
-  tree vec_shuffle, tmp;
+  tree vec_shuffle;
   bool wrap = true;
   bool maybe_const = false;
-  bool two_arguments;
+  bool two_arguments = false;
 
   if (v1 == NULL_TREE)
     {
@@ -2916,17 +2916,16 @@  c_build_vec_shuffle_expr (location_t loc, tree v0, tree v1, tree mask)
     }
 
   /* Avoid C_MAYBE_CONST_EXPRs inside VEC_SHUFFLE_EXPR.  */
-  tmp = c_fully_fold (v0, false, &maybe_const);
-  v0 = save_expr (tmp);
+  v0 = c_fully_fold (v0, false, &maybe_const);
   wrap &= maybe_const;
 
-  if (!two_arguments)
+  if (two_arguments)
+    v1 = v0 = save_expr (v0);
+  else
     {
       v1 = c_fully_fold (v1, false, &maybe_const);
       wrap &= maybe_const;
     }
-  else
-    v1 = v0;
 
   mask = c_fully_fold (mask, false, &maybe_const);
   wrap &= maybe_const;