Hi!

Another regression caused by the delayed SIZEOF_EXPR evaluation.
For the purposes of -Wsequence-point warnings we should never
recurse into SIZEOF_EXPR operand, the expressions in there aren't
evaluated there.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8?

2013-05-14  Jakub Jelinek  <ja...@redhat.com>

        PR c++/57274
        * c-common.c (verify_tree): Don't recurse into SIZEOF_EXPR.

        * c-c++-common/Wsequence-point-1.c: New test.

--- gcc/c-family/c-common.c.jj  2013-05-13 09:44:53.000000000 +0200
+++ gcc/c-family/c-common.c     2013-05-14 17:04:59.273912576 +0200
@@ -3032,6 +3032,7 @@ verify_tree (tree x, struct tlist **pbef
   switch (code)
     {
     case CONSTRUCTOR:
+    case SIZEOF_EXPR:
       return;
 
     case COMPOUND_EXPR:
--- gcc/testsuite/c-c++-common/Wsequence-point-1.c.jj   2013-05-14 
17:02:55.588608130 +0200
+++ gcc/testsuite/c-c++-common/Wsequence-point-1.c      2013-05-14 
17:01:06.000000000 +0200
@@ -0,0 +1,17 @@
+/* PR c++/57274 */
+/* { dg-do compile } */
+/* { dg-options "-Wsequence-point" } */
+
+void foo (int, int);
+
+void
+bar (int *x)
+{
+  foo (*x++, sizeof (*x));     /* { dg-bogus "may be undefined" } */
+}
+
+void
+baz (int *x)
+{
+  foo (*x, sizeof (*x++) + sizeof (*x++));     /* { dg-bogus "may be 
undefined" } */
+}

        Jakub

Reply via email to