re PR c/25875 (ICE: segmentation fault)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 21 Apr 2006 23:02:26 +0000 (23:02 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 21 Apr 2006 23:02:26 +0000 (23:02 +0000)
PR c/25875
* c-typeck.c (digest_init): Robustify.

* gcc.dg/init-bad-4.c: New test.

From-SVN: r113153

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

index b2840b6ded964d03bb55b638097778aa89390259..b50622486f8c9e01c3f55bc481431f4a8f6ecabc 100644 (file)
@@ -1,5 +1,8 @@
 2006-04-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c/25875
+       * c-typeck.c (digest_init): Robustify.
+
        * c-typeck.c (pop_init_level): Simplify.
 
 2006-04-21  Steve Ellcey  <sje@cup.hp.com>
index 73c120d16a30d0332f6da9237b447a7b96515613..21fe12538a2a8cd78549f3b1fd54751607a1447d 100644 (file)
@@ -4495,6 +4495,7 @@ digest_init (tree type, tree init, bool strict_string, int require_constant)
   tree inside_init = init;
 
   if (type == error_mark_node
+      || !init
       || init == error_mark_node
       || TREE_TYPE (init) == error_mark_node)
     return error_mark_node;
index 544ec0d47c8686f9f2f04875c0f431c92e6649ac..6cdaade89982f734a0a45c56b18793f7e1839536 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c/25875
+       * gcc.dg/init-bad-4.c: New test.
+
 2006-04-21  Paul Brook  <paul@codesourcery.com>
 
        * gcc.dg/arm-vfp1.c: Skip on iWMMXt cpus.
diff --git a/gcc/testsuite/gcc.dg/init-bad-4.c b/gcc/testsuite/gcc.dg/init-bad-4.c
new file mode 100644 (file)
index 0000000..3f03002
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR c/25875 */
+/* 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" } */