re PR c/35744 (ICE attributes for invalid types)
authorVolker Reichelt <v.reichelt@netcologne.de>
Fri, 11 Apr 2008 06:55:38 +0000 (06:55 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 11 Apr 2008 06:55:38 +0000 (06:55 +0000)
PR c/35744
* attribs.c (decl_attributes): Return early on errorneous node.

* gcc.dg/attr-error-1.c: New test.

From-SVN: r134193

gcc/ChangeLog
gcc/attribs.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/attr-error-1.c [new file with mode: 0644]

index 52f8d10c40ca025991679208b318508f4f3b64f4..bc19665285c3e99a7fbb223b32aac3149216d243 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-11  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35744
+       * attribs.c (decl_attributes): Return early on errorneous node.
+
 2008-04-10  Oleg Ryjkov  <olegr@google.com>
 
        * tree.h (struct tree_base): Added a new flag default_def_flag.
index 767035b5dd10af44b63f7d19e86714170635d1ba..65233de9e55a9f0ac692c395da31f90af45156b4 100644 (file)
@@ -225,6 +225,9 @@ decl_attributes (tree *node, tree attributes, int flags)
   tree a;
   tree returned_attrs = NULL_TREE;
 
+  if (TREE_TYPE (*node) == error_mark_node)
+    return NULL_TREE;
+
   if (!attributes_initialized)
     init_attributes ();
 
index b22bcd48bc42f84d54cdae3bbd59eb6a6e7d5d93..5f238b62eddaf87f7106f7f13540855a489040bb 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-11  Volker Reichelt  <v.reichelt@netcologne.de>
+
+       PR c/35744
+       * gcc.dg/attr-error-1.c: New test.
+
 2008-04-10  Adam Nemet  <anemet@caviumnetworks.com>
 
        * gcc.target/mips/scc-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/attr-error-1.c b/gcc/testsuite/gcc.dg/attr-error-1.c
new file mode 100644 (file)
index 0000000..c136484
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR c/35744 */
+
+typedef char a[N] __attribute__((aligned(4))); /* { dg-error "undeclared" } */
+
+void c[1] __attribute__((vector_size(8))); /* { dg-error "array of voids" } */
+
+void b[1] __attribute__((may_alias)); /* { dg-error "array of voids" } */
+
+struct A
+{
+  void d[1] __attribute__((packed)); /* { dg-error "array of voids" } */
+};