]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c/35446 (ICE with invalid array initializer)
authorJoseph Myers <joseph@codesourcery.com>
Mon, 16 Feb 2009 22:55:56 +0000 (22:55 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Mon, 16 Feb 2009 22:55:56 +0000 (22:55 +0000)
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.

From-SVN: r144216

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/init-bad-4.c
gcc/testsuite/gcc.dg/noncompile/init-5.c [new file with mode: 0644]

index 981f150f3b17cd853ade30c7acc81fb97e5cd1cb..e30a66812ab4a69097441c937da4f20932894ca6 100644 (file)
@@ -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
index e09c2c17161b4e1275762ca7a32aad13047f536e..9aef031a8eb6d7a426283ddc6774443283d36d5f 100644 (file)
@@ -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);
index 73f0bc58a6ed36a4a821883a9a79dccb6b836ca7..a16adbd035c5998110ad8becb1424c15506d0393 100644 (file)
@@ -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
index 3f03002908a91d76ec7e7eb80ff825407e258de8..c8c11845c5c2853f0e0629b1665b00c530f3a375 100644 (file)
@@ -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 (file)
index 0000000..366397a
--- /dev/null
@@ -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" } */
This page took 0.105039 seconds and 5 git commands to generate.