diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-04 13:58:42 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-04 13:58:42 +0000 |
commit | 4dc955c887529ba76595516911a841033eef0c00 (patch) | |
tree | d21cf970781e413baf152e71ea6897bc4c8b7006 /gcc/c-decl.c | |
parent | 287cbb2e49e0bf1714f18ca16d8a77cc9ba05f24 (diff) | |
download | gcc-4dc955c887529ba76595516911a841033eef0c00.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104943 138bc75d-0d04-0410-961f-82ee72b054a4
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 1caf0b901bc..c274df47ac4 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 |