From 21516d643e740854ca7754bfd997539f4bc1183d Mon Sep 17 00:00:00 2001 From: Volker Reichelt Date: Fri, 11 Apr 2008 06:55:38 +0000 Subject: [PATCH] re PR c/35744 (ICE attributes for invalid types) 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 | 5 +++++ gcc/attribs.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/attr-error-1.c | 12 ++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/attr-error-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 52f8d10c40c..bc19665285c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-04-11 Volker Reichelt + + PR c/35744 + * attribs.c (decl_attributes): Return early on errorneous node. + 2008-04-10 Oleg Ryjkov * tree.h (struct tree_base): Added a new flag default_def_flag. diff --git a/gcc/attribs.c b/gcc/attribs.c index 767035b5dd1..65233de9e55 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b22bcd48bc4..5f238b62edd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-11 Volker Reichelt + + PR c/35744 + * gcc.dg/attr-error-1.c: New test. + 2008-04-10 Adam Nemet * 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 index 00000000000..c136484a151 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-error-1.c @@ -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" } */ +}; -- 2.30.2