diff options
author | Joseph Myers <joseph@codesourcery.com> | 2009-02-18 00:38:28 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2009-02-18 00:38:28 +0000 |
commit | 5600f233ef5f740908f0480b76936e503b1d4cda (patch) | |
tree | b808756b4789718dbb49b44aabd79d616d50a129 /gcc/c-parser.c | |
parent | afd1efee35d08f8807f02ce15eddae717c935047 (diff) | |
download | gcc-5600f233ef5f740908f0480b76936e503b1d4cda.tar.gz |
re PR c/35447 (ICE with broken statement expression)
PR c/35447
* c-parser.c (c_parser_compound_statement): Always enter and leave
a scope.
testsuite:
* gcc.dg/noncompile/pr35447-1.c: New test.
From-SVN: r144256
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 9aef031a8eb..6dfcb601597 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -3307,7 +3307,13 @@ c_parser_compound_statement (c_parser *parser) { tree stmt; if (!c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>")) - return error_mark_node; + { + /* Ensure a scope is entered and left anyway to avoid confusion + if we have just prepared to enter a function body. */ + stmt = c_begin_compound_stmt (true); + c_end_compound_stmt (stmt, true); + return error_mark_node; + } stmt = c_begin_compound_stmt (true); c_parser_compound_statement_nostart (parser); return c_end_compound_stmt (stmt, true); |