diff options
author | Richard Guenther <rguenther@suse.de> | 2005-10-04 13:58:42 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-10-04 13:58:42 +0000 |
commit | 9df594d7e7119cbbb3618298054ab15d4d3db258 (patch) | |
tree | d21cf970781e413baf152e71ea6897bc4c8b7006 /gcc/c-decl.c | |
parent | 11e3f4b6f733c96148bea5747f793f020f4aeadb (diff) | |
download | gcc-9df594d7e7119cbbb3618298054ab15d4d3db258.zip gcc-9df594d7e7119cbbb3618298054ab15d4d3db258.tar.gz gcc-9df594d7e7119cbbb3618298054ab15d4d3db258.tar.bz2 |
re PR c/23576 (tree check: expected class ‘type’, have exceptional’ (error_mark) in grokdeclarator, at c-decl.c:4252)
2005-10-04 Richard Guenther <rguenther@suse.de>
PR c/23576
* c-decl.c (grokdeclarator): Don't write to fields
of error_mark_node.
* gcc.dg/noncompile/pr23576.c: New testcase.
From-SVN: r104943
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1caf0b9..c274df4 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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 |