2005-10-04 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Oct 2005 13:58:42 +0000 (13:58 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Oct 2005 13:58:42 +0000 (13:58 +0000)
PR c/23576
* c-decl.c (grokdeclarator): Don't write to fields
of error_mark_node.

* gcc.dg/noncompile/pr23576.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104943 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/pr23576.c [new file with mode: 0644]

index a0c8dcc..9c00674 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-04  Richard Guenther  <rguenther@suse.de>
+
+       PR c/23576
+       * c-decl.c (grokdeclarator): Don't write to fields
+       of error_mark_node.
+
 2005-10-04  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/23125
index 1caf0b9..c274df4 100644 (file)
@@ -4248,16 +4248,19 @@ grokdeclarator (const struct c_declarator *declarator,
            else
              type = build_array_type (type, itype);
 
-           if (size_varies)
-             C_TYPE_VARIABLE_SIZE (type) = 1;
-
-           /* The GCC extension for zero-length arrays differs from
-              ISO flexible array members in that sizeof yields
-              zero.  */
-           if (size && integer_zerop (size))
+           if (type != error_mark_node)
              {
-               TYPE_SIZE (type) = bitsize_zero_node;
-               TYPE_SIZE_UNIT (type) = size_zero_node;
+               if (size_varies)
+               C_TYPE_VARIABLE_SIZE (type) = 1;
+
+               /* The GCC extension for zero-length arrays differs from
+                  ISO flexible array members in that sizeof yields
+                  zero.  */
+               if (size && integer_zerop (size))
+                 {
+                   TYPE_SIZE (type) = bitsize_zero_node;
+                   TYPE_SIZE_UNIT (type) = size_zero_node;
+                 }
              }
 
            if (decl_context != PARM
index 1eb0c21..8bc316d 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-04  Richard Guenther  <rguenther@suse.de>
+
+       PR c/23576
+       * gcc.dg/noncompile/pr23576.c: New testcase.
+
 2005-10-04  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/23125
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr23576.c b/gcc/testsuite/gcc.dg/noncompile/pr23576.c
new file mode 100644 (file)
index 0000000..384b0f6
--- /dev/null
@@ -0,0 +1 @@
+struct ipr_path_entry path[0]; /* { dg-error "array type has incomplete element type" } */