]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/35446 (ICE with invalid array initializer)
authorJoseph Myers <joseph@codesourcery.com>
Tue, 17 Feb 2009 13:00:40 +0000 (13:00 +0000)
committerJoseph Myers <jsm28@gcc.gnu.org>
Tue, 17 Feb 2009 13:00:40 +0000 (13:00 +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: r144227

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 bcfb24c4b2b95fb7bf23e501f9e32b34e8c8a53f..0d4f87b72866e31dba6b285ee353bf5014078636 100644 (file)
@@ -1,3 +1,9 @@
+2009-02-17  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-13  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/35444
index f0e17952b12c04839363f9d9e8ccd7611b968288..26d1731de002ddf0e09133fbe15c2acb34a21ed4 100644 (file)
@@ -3134,6 +3134,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 38cbbe467fdfc9c773044cd49a5ebe699f2ac8e7..dd8a030b82e2d6ccf78aafdf1ce8a12499ea30ca 100644 (file)
@@ -1,3 +1,9 @@
+2009-02-17  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-15  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/struct/w_prof_single_str_global.c: Mask return value.
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" } */