(internal_build_compound_expr): When pedantic...
authorJim Wilson <wilson@gcc.gnu.org>
Mon, 12 Apr 1993 19:44:47 +0000 (12:44 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Mon, 12 Apr 1993 19:44:47 +0000 (12:44 -0700)
(internal_build_compound_expr): When pedantic, don't
simplify a COMPOUND_EXPR, so that it won't be mistaken for an
lvalue or an integer constant expression.

From-SVN: r4102

gcc/c-typeck.c

index e6d46ed7d27abcb3ba1422f2d005baa2db4a2c2f..d7745e3abf0b420fd765446d71ac4145c333a083 100644 (file)
@@ -3788,7 +3788,9 @@ internal_build_compound_expr (list, first_p)
 
   rest = internal_build_compound_expr (TREE_CHAIN (list), FALSE);
 
-  if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)))
+  /* When pedantic, a compound expression can be neither an lvalue
+     nor an integer constant expression.  */
+  if (! TREE_SIDE_EFFECTS (TREE_VALUE (list)) && ! pedantic)
     return rest;
 
   return build (COMPOUND_EXPR, TREE_TYPE (rest), TREE_VALUE (list), rest);