diff mbox

[C++] PR58950: warn for unused __builtin_shuffle result

Message ID alpine.DEB.2.02.1401031444260.29627@stedding.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse Jan. 3, 2014, 3:09 p.m. UTC
Hello,

this is the piece of patch you commented on in the PR.

Bootstrap+testsuite on x86_64-unknown-linux-gnu.

2014-01-03  Marc Glisse  <marc.glisse@inria.fr>

 	PR c++/58950
gcc/cp/
         * cvt.c (convert_to_void): Handle VEC_PERM_EXPR and VEC_COND_EXPR.
gcc/testsuite/
 	* g++.dg/pr58950.C: New file.

Comments

Jason Merrill Jan. 3, 2014, 6:52 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	(revision 206313)
+++ gcc/cp/cvt.c	(working copy)
@@ -1396,21 +1396,23 @@  convert_to_void (tree expr, impl_conv_vo
 	      code = TREE_CODE (e);
 	      tclass = TREE_CODE_CLASS (code);
 	      if ((tclass == tcc_comparison
 		   || tclass == tcc_unary
 		   || (tclass == tcc_binary
 		       && !(code == MODIFY_EXPR
 			    || code == INIT_EXPR
 			    || code == PREDECREMENT_EXPR
 			    || code == PREINCREMENT_EXPR
 			    || code == POSTDECREMENT_EXPR
-			    || code == POSTINCREMENT_EXPR)))
+			    || code == POSTINCREMENT_EXPR))
+		   || code == VEC_PERM_EXPR
+		   || code == VEC_COND_EXPR)
                   && (complain & tf_warning))
 		warning_at (loc, OPT_Wunused_value, "value computed is not used");
 	    }
 	}
       expr = build1 (CONVERT_EXPR, void_type_node, expr);
     }
   if (! TREE_SIDE_EFFECTS (expr))
     expr = void_zero_node;
   return expr;
 }
Index: gcc/testsuite/g++.dg/pr58950.C
===================================================================
--- gcc/testsuite/g++.dg/pr58950.C	(revision 0)
+++ gcc/testsuite/g++.dg/pr58950.C	(working copy)
@@ -0,0 +1,8 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+void f(){
+  int i __attribute__((vector_size(2*sizeof(int)))) = { 2, 3 };
+  __builtin_shuffle (i, i); /* { dg-warning "value computed is not used" } */
+  ++i?1:0; /* { dg-warning "value computed is not used" } */
+}