summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-16 22:55:56 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-16 22:55:56 +0000
commit1646bf33fc44a6aa108f87fc903835203a6f70a7 (patch)
treeead750183f414452b82a0ca13a1347344d4a8b69
parent0fb2a9980fb514705fca77f06309793b76c7e917 (diff)
downloadgcc-1646bf33fc44a6aa108f87fc903835203a6f70a7.tar.gz
PR c/35446
* c-parser.c (c_parser_braced_init): Call pop_init_level when skipping until next close brace. testsuite: * gcc.dg/noncompile/init-5.c: New test. * gcc.dg/init-bad-4.c: Adjust expected errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144216 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-parser.c1
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/init-bad-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/init-5.c4
5 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 981f150f3b1..e30a66812ab 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-16 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/35446
+ * c-parser.c (c_parser_braced_init): Call pop_init_level when
+ skipping until next close brace.
+
2009-02-16 H.J. Lu <hongjiu.lu@intel.com>
PR target/37049
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index e09c2c17161..9aef031a8eb 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -3036,6 +3036,7 @@ c_parser_braced_init (c_parser *parser, tree type, bool nested_p)
ret.value = error_mark_node;
ret.original_code = ERROR_MARK;
c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, "expected %<}%>");
+ pop_init_level (0);
return ret;
}
c_parser_consume_token (parser);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 73f0bc58a6e..a16adbd035c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-16 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/35446
+ * gcc.dg/noncompile/init-5.c: New test.
+ * gcc.dg/init-bad-4.c: Adjust expected errors.
+
2009-02-16 H.J. Lu <hongjiu.lu@intel.com>
PR target/37049
diff --git a/gcc/testsuite/gcc.dg/init-bad-4.c b/gcc/testsuite/gcc.dg/init-bad-4.c
index 3f03002908a..c8c11845c5c 100644
--- a/gcc/testsuite/gcc.dg/init-bad-4.c
+++ b/gcc/testsuite/gcc.dg/init-bad-4.c
@@ -2,4 +2,4 @@
/* Origin: Richard Guenther <rguenth@gcc.gnu.org> */
/* { dg-do compile } */
-struct A { } a = (struct A) {{ (X)0 }}; /* { dg-error "no members|extra brace|near|undeclared|constant|compound" } */
+struct A { } a = (struct A) {{ (X)0 }}; /* { dg-error "no members|extra brace|near|undeclared|constant|compound|excess" } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/init-5.c b/gcc/testsuite/gcc.dg/noncompile/init-5.c
new file mode 100644
index 00000000000..366397aefad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/init-5.c
@@ -0,0 +1,4 @@
+/* Test for ICE after syntax error in initializer with range
+ designator: PR 35446. */
+
+int a[2][2] = { [0 ... 1] = { ; } }; /* { dg-error "expected expression" } */