aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-08 23:33:54 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-08 23:33:54 -0400
commit4063e61bc63c3803f8ab2d625ebe8432ac06b3da (patch)
tree2933e4a1c40cd6d7cb203f1eec34d632fcacf4b8 /gcc/testsuite
parent2fda8e144a7db5ba6025cfe643da0c6111cc2b0f (diff)
downloadgcc-4063e61bc63c3803f8ab2d625ebe8432ac06b3da.zip
gcc-4063e61bc63c3803f8ab2d625ebe8432ac06b3da.tar.gz
gcc-4063e61bc63c3803f8ab2d625ebe8432ac06b3da.tar.bz2
re PR c++/45437 (Loses reference during update)
PR c++/45437 gcc/ * gimplify.c (goa_stabilize_expr): Handle RHS preevaluation in compound assignment. gcc/c-family/ * c-omp.c (check_omp_for_incr_expr): Handle preevaluation. gcc/cp/ * typeck.c (cp_build_modify_expr): Preevaluate RHS. From-SVN: r176072
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/expr/compound-asn1.C15
-rw-r--r--gcc/testsuite/g++.dg/warn/sequence-pt-1.C2
3 files changed, 22 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fc6931a..5b8be33 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/45437
+ * g++.dg/expr/compound-asn1.C: New.
+ * g++.dg/warn/sequence-pt-1.C: Change one dg-error to dg-bogus.
+
2011-07-08 Jakub Jelinek <jakub@redhat.com>
PR target/49621
diff --git a/gcc/testsuite/g++.dg/expr/compound-asn1.C b/gcc/testsuite/g++.dg/expr/compound-asn1.C
new file mode 100644
index 0000000..194235c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/compound-asn1.C
@@ -0,0 +1,15 @@
+// PR c++/45437
+// { dg-options -Wsequence-point }
+// { dg-do run }
+
+bool f(bool& b) {
+ b = true;
+ return false;
+}
+
+int main() {
+ bool b = false;
+ b |= f(b);
+ if (!b)
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/warn/sequence-pt-1.C b/gcc/testsuite/g++.dg/warn/sequence-pt-1.C
index 05eee82..6a98fd7 100644
--- a/gcc/testsuite/g++.dg/warn/sequence-pt-1.C
+++ b/gcc/testsuite/g++.dg/warn/sequence-pt-1.C
@@ -62,7 +62,7 @@ foo (int a, int b, int n, int p, int *ptr, struct s *sptr,
(a = a++) && b; /* { dg-warning "undefined" "sequence point warning" } */
b, (a = a++); /* { dg-warning "undefined" "sequence point warning" } */
(a = a++), b; /* { dg-warning "undefined" "sequence point warning" } */
- a ^= b ^= a ^= b; /* { dg-warning "undefined" "sequence point warning" } */
+ a ^= b ^= a ^= b; /* { dg-bogus "undefined" "sequence point warning" } */
a = a; /* { dg-bogus "undefined" "bogus sequence point warning" } */
a = (a++ && 4); /* { dg-bogus "undefined" "bogus sequence point warning" } */