re PR middle-end/22028 (ICE after invalid struct declaration)
authorJakub Jelinek <jakub@redhat.com>
Sun, 26 Jun 2005 05:23:48 +0000 (07:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 26 Jun 2005 05:23:48 +0000 (07:23 +0200)
PR middle-end/22028
* gimplify.c (gimplify_type_sizes): Check for type == error_mark_node
earlier in the function.

* gcc.dg/20050620-1.c: New test.

From-SVN: r101332

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20050620-1.c [new file with mode: 0644]

index aaccb6efe1ebb166574bf36fc7175baae624fd10..751cc708ee6348a9da394397264644689eb0bb0c 100644 (file)
@@ -1,5 +1,9 @@
 2005-06-26  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/22028
+       * gimplify.c (gimplify_type_sizes): Check for type == error_mark_node
+       earlier in the function.
+
        * regrename.c (copy_value): Don't replace fixed or global
        regs with older regs.
 
index 156e56744a57f8f9a109748f8fc14b13eb37b367..8bc790877747b50e46b5c45607f2955b6756e583 100644 (file)
@@ -4524,15 +4524,14 @@ gimplify_type_sizes (tree type, tree *list_p)
 {
   tree field, t;
 
-  if (type == NULL)
+  if (type == NULL || type == error_mark_node)
     return;
 
   /* We first do the main variant, then copy into any other variants.  */
   type = TYPE_MAIN_VARIANT (type);
 
   /* Avoid infinite recursion.  */
-  if (TYPE_SIZES_GIMPLIFIED (type)
-      || type == error_mark_node)
+  if (TYPE_SIZES_GIMPLIFIED (type))
     return;
 
   TYPE_SIZES_GIMPLIFIED (type) = 1;
index 71961848bd3ac1c2642340d242c7ecedba4f91e5..a8ca329b3267bc295f6068d7b2d9d0ab4c5a99c5 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-26  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/22028
+       * gcc.dg/20050620-1.c: New test.
+
 2005-06-26  Kazu Hirata  <kazu@codesourcery.com>
 
        PR tree-optimization/22026
diff --git a/gcc/testsuite/gcc.dg/20050620-1.c b/gcc/testsuite/gcc.dg/20050620-1.c
new file mode 100644 (file)
index 0000000..befdd96
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/22028 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+  struct { int i[]; } u;       /* { dg-error "flexible array member" } */
+}
+
+void
+bar (void)
+{
+  struct { struct a b; } c;    /* { dg-error "has incomplete type" } */
+}