]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/78949 (incorrect "unused variable" warning with SSE2)
authorJakub Jelinek <jakub@redhat.com>
Wed, 4 Jan 2017 21:34:27 +0000 (22:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 4 Jan 2017 21:34:27 +0000 (22:34 +0100)
PR c++/78949
* typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
vector type.

* c-c++-common/Wunused-var-16.c: New test.

From-SVN: r244075

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wunused-var-16.c [new file with mode: 0644]

index 833b9049ee44c1354f57d96c2d143cd764957b59..8dc6588ec31ce1b09b42abed0d6bb9d019ca7fbe 100644 (file)
@@ -1,5 +1,9 @@
 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/78949
+       * typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
+       vector type.
+
        PR c++/78693
        * parser.c (cp_parser_simple_declaration): Only complain about
        inconsistent auto deduction if auto_result doesn't use auto.
index 57a69efb81e73501568459c984d76c0a7c6e826b..6da98f65bdd3d150396db1dd8af0b38b9324a637 100644 (file)
@@ -5907,6 +5907,8 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
            inform (location, "did you mean to use logical not (%<!%>)?");
          arg = cp_perform_integral_promotions (arg, complain);
        }
+      else if (!noconvert && VECTOR_TYPE_P (TREE_TYPE (arg)))
+       arg = mark_rvalue_use (arg);
       break;
 
     case ABS_EXPR:
index abdb8bb5a7eacb323a1e7306e80a21767cffdaed..f56c11b957f9005200d95329709bb4f26eb07ee8 100644 (file)
@@ -1,5 +1,8 @@
 2017-01-04  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/78949
+       * c-c++-common/Wunused-var-16.c: New test.
+
        PR c++/78693
        * g++.dg/cpp0x/pr78693.C: New test.
 
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-16.c b/gcc/testsuite/c-c++-common/Wunused-var-16.c
new file mode 100644 (file)
index 0000000..98e66a7
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR c++/78949 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+typedef unsigned char V __attribute__((vector_size(16)));
+V v;
+
+void
+foo ()
+{
+  V y = {};
+  V x = {};    // { dg-bogus "set but not used" }
+  y &= ~x;
+  v = y;
+}
This page took 0.072278 seconds and 5 git commands to generate.