aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-10-24 01:44:17 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2009-10-24 01:44:17 +0100
commit26d8af3556969fc8eeda5adfe314553484ad9751 (patch)
tree389dcf1ce9bb16d2ed2b5109dd50c21b8ac5c1b3
parent5e86b38ccb7f753ffe54b2e2a46c22a8f54cb51b (diff)
downloadgcc-26d8af3556969fc8eeda5adfe314553484ad9751.zip
gcc-26d8af3556969fc8eeda5adfe314553484ad9751.tar.gz
gcc-26d8af3556969fc8eeda5adfe314553484ad9751.tar.bz2
re PR c/40033 (ICE with invalid statement expression)
PR c/40033 * c-typeck.c (c_finish_stmt_expr): Do not wrap error_mark_node in a C_MAYBE_CONST_EXPR. testsuite: * gcc.dg/noncompile/pr40033-1.c: New test. From-SVN: r153522
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr40033-1.c7
4 files changed, 23 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e7068a9..c85ff0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2009-10-23 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/41787
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index e7425a7..3274e07 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -8653,11 +8653,13 @@ c_finish_stmt_expr (location_t loc, tree body)
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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c44b4d7..e7ba1b6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-23 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/40033
+ * gcc.dg/noncompile/pr40033-1.c: New test.
+
2009-10-23 Dodji Seketeli <dodji@redhat.com>
PR c++/40808
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c b/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
new file mode 100644
index 0000000..4f07442
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
@@ -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" } */
+}