+2019-08-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/91415
+ * c-common.c (verify_tree): For LSHIFT_EXPR, RSHIFT_EXPR,
+ COMPONENT_REF and ARRAY_REF in cxx_dialect >= cxx17 mode handle it
+ like COMPOUND_EXPR rather than normal expression.
+
2019-08-23 Iain Sandoe <iain@sandoe.co.uk>
PR pch/61250
case COMPOUND_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
+ sequenced_binary:
tmp_before = tmp_nosp = tmp_list2 = tmp_list3 = 0;
verify_tree (TREE_OPERAND (x, 0), &tmp_before, &tmp_nosp, NULL_TREE);
warn_for_collisions (tmp_nosp);
x = TREE_OPERAND (x, 0);
goto restart;
}
- gcc_fallthrough ();
+ goto do_default;
+
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
+ case COMPONENT_REF:
+ case ARRAY_REF:
+ if (cxx_dialect >= cxx17)
+ goto sequenced_binary;
+ goto do_default;
+
default:
+ do_default:
/* For other expressions, simply recurse on their operands.
Manual tail recursion for unary expressions.
Other non-expressions need not be processed. */
--- /dev/null
+/* More sequence point warning tests */
+/* { dg-do compile } */
+/* { dg-options "-Wsequence-point" } */
+
+struct S { int a[10]; };
+void bar (int, int, int, int, int, int, int, int);
+
+int
+foo (int i, int x[10][10], int y[10], struct S z[10], struct S *w[10])
+{
+ int b = x[i++][i++]; /* { dg-warning "undefined" "sequence point warning" { target c++14_down } } */
+ int c = i++ << i++; /* { dg-warning "undefined" "sequence point warning" { target c++14_down } } */
+ int d = i++ >> i++; /* { dg-warning "undefined" "sequence point warning" { target c++14_down } } */
+ int e = i++ && i++;
+ int f = i++ ? i++ : i++;
+ int g = (i++, i++);
+ int h = z[i++].a[i++]; /* { dg-warning "undefined" "sequence point warning" { target c++14_down } } */
+ int j = w[i++]->a[i++]; /* { dg-warning "undefined" "sequence point warning" { target c++14_down } } */
+ bar (b, c, d, e, f,g, h, j);
+ return i;
+}