This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

--
Marc Glisse
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" } */
+}

Property changes on: gcc/testsuite/g++.dg/pr58950.C
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision URL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]