From: Volker Reichelt Date: Mon, 22 May 2006 12:20:41 +0000 (+0000) Subject: re PR c/26818 (tree check: expected class ‘type’, have ‘exceptional’ (error_mark... X-Git-Tag: releases/gcc-4.2.0~2792 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4271a6f36886a604cf9f39d85408b0a2dbe45ecd;p=thirdparty%2Fgcc.git re PR c/26818 (tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in finish_struct, at c-decl.c:5350 (time.c)) PR c/26818 * c-decl.c (finish_struct): Skip erroneous fields. * gcc.dg/struct-incompl-1.c: New test. From-SVN: r113975 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 281fdc345a7f..5fb269ec70f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2006-05-22 Volker Reichelt + + PR c/26818 + * c-decl.c (finish_struct): Skip erroneous fields. + 2006-05-22 Nick Clifton * config/cris/cris.opt (march): Remove VarExists attribute. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9ece1ce764d6..d7362c10896e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5396,6 +5396,9 @@ finish_struct (tree t, tree fieldlist, tree attributes) saw_named_field = 0; for (x = fieldlist; x; x = TREE_CHAIN (x)) { + if (TREE_TYPE (x) == error_mark_node) + continue; + DECL_CONTEXT (x) = t; if (TYPE_PACKED (t) && TYPE_ALIGN (TREE_TYPE (x)) > BITS_PER_UNIT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 84771312fe28..a1c67031302a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-22 Volker Reichelt + + PR c/26818 + * gcc.dg/struct-incompl-1.c: New test. + 2006-05-22 Richard Guenther PR testsuite/27708 diff --git a/gcc/testsuite/gcc.dg/struct-incompl-1.c b/gcc/testsuite/gcc.dg/struct-incompl-1.c new file mode 100644 index 000000000000..c32b2d53849d --- /dev/null +++ b/gcc/testsuite/gcc.dg/struct-incompl-1.c @@ -0,0 +1,7 @@ +/* PR c/26818 */ +/* { dg-do compile } */ + +struct __attribute__ ((packed)) A +{ + struct B b; /* { dg-error "incomplete" } */ +};