re PR c++/58814 (ICE with volatile and attribute vector_size)
authorJason Merrill <jason@redhat.com>
Tue, 28 Jan 2014 04:30:38 +0000 (23:30 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 28 Jan 2014 04:30:38 +0000 (23:30 -0500)
PR c++/58814
* typeck.c (cp_build_modify_expr): Make the RHS an rvalue before
stabilizing.

From-SVN: r207163

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/g++.dg/ext/vector25.C [new file with mode: 0644]

index 42adc480f183bd557499c2804d902ba4ced3bf83..b5693f2e124006da1b4a82057ce534ed038bac01 100644 (file)
@@ -1,5 +1,9 @@
 2014-01-27  Jason Merrill  <jason@redhat.com>
 
+       PR c++/58814
+       * typeck.c (cp_build_modify_expr): Make the RHS an rvalue before
+       stabilizing.
+
        PR c++/58837
        * typeck.c (cp_truthvalue_conversion): Use explicit comparison for
        FUNCTION_DECL.
index b7ece1bf771704be4d6ebedda684f3b87eeb1d07..6268f7bfbba8acdac9d43e7f6149be334b377cd0 100644 (file)
@@ -7399,8 +7399,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
             side effect associated with any single compound assignment
             operator. -- end note ]  */
          lhs = stabilize_reference (lhs);
-         if (TREE_SIDE_EFFECTS (rhs))
-           rhs = mark_rvalue_use (rhs);
+         rhs = rvalue (rhs);
          rhs = stabilize_expr (rhs, &init);
          newrhs = cp_build_binary_op (input_location,
                                       modifycode, lhs, rhs,
diff --git a/gcc/testsuite/g++.dg/ext/vector25.C b/gcc/testsuite/g++.dg/ext/vector25.C
new file mode 100644 (file)
index 0000000..6c1f5d0
--- /dev/null
@@ -0,0 +1,6 @@
+volatile int i __attribute__((vector_size(8)));
+
+void foo()
+{
+  i += i;
+}