public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR c/40033 (ICE-on-invalid)
@ 2009-10-24  3:59 Joseph S. Myers
  0 siblings, 0 replies; only message in thread
From: Joseph S. Myers @ 2009-10-24  3:59 UTC (permalink / raw)
  To: gcc-patches

This patch fixes PR 40033, an ICE-on-invalid regression where
error_mark_node wrongly got wrapped in a C_MAYBE_CONST_EXPR.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Applied
to mainline.

2009-10-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/40033
	* c-typeck.c (c_finish_stmt_expr): Do not wrap error_mark_node in
	a C_MAYBE_CONST_EXPR.

testsuite:
2009-10-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/40033
	* gcc.dg/noncompile/pr40033-1.c: New test.

Index: testsuite/gcc.dg/noncompile/pr40033-1.c
===================================================================
--- testsuite/gcc.dg/noncompile/pr40033-1.c	(revision 0)
+++ testsuite/gcc.dg/noncompile/pr40033-1.c	(revision 0)
@@ -0,0 +1,7 @@
+/* ICE from error_mark_node being wrapped in a C_MAYBE_CONST_EXPR.  PR
+   40033.  */
+
+void foo()
+{
+  ({ 0,; }); /* { dg-error "expected" } */
+}
Index: c-typeck.c
===================================================================
--- c-typeck.c	(revision 153496)
+++ c-typeck.c	(working copy)
@@ -8653,11 +8653,13 @@ c_finish_stmt_expr (location_t loc, tree
       goto continue_searching;
     }
 
+  if (last == error_mark_node)
+    return last;
+
   /* In the case that the BIND_EXPR is not necessary, return the
      expression out from inside it.  */
-  if (last == error_mark_node
-      || (last == BIND_EXPR_BODY (body)
-	  && BIND_EXPR_VARS (body) == NULL))
+  if (last == BIND_EXPR_BODY (body)
+      && BIND_EXPR_VARS (body) == NULL)
     {
       /* Even if this looks constant, do not allow it in a constant
 	 expression.  */

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-24  0:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-24  3:59 Fix PR c/40033 (ICE-on-invalid) Joseph S. Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).