diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-03-22 16:28:06 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2004-03-22 16:28:06 +0100 |
commit | d915eec0db44e5b9c50585ea77cf12daaf71de4a (patch) | |
tree | e522b26caa2d20f25e0ae5a80dbd037ad709e5a2 /gcc/c-decl.c | |
parent | 19a0330388adbe2baae823dd85cdab560d83f456 (diff) | |
download | gcc-d915eec0db44e5b9c50585ea77cf12daaf71de4a.zip gcc-d915eec0db44e5b9c50585ea77cf12daaf71de4a.tar.gz gcc-d915eec0db44e5b9c50585ea77cf12daaf71de4a.tar.bz2 |
re PR c/14069 (This input file lets gcc crash)
PR c/14069
* c-decl.c (finish_struct): Change type of incorrect flexible array
field into error_mark_node.
* gcc.dg/20040322-1.c: New test.
From-SVN: r79832
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 46f352b..46863ed 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5018,11 +5018,20 @@ finish_struct (tree t, tree fieldlist, tree attributes) && TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (x))) == NULL_TREE) { if (TREE_CODE (t) == UNION_TYPE) - error ("%Jflexible array member in union", x); + { + error ("%Jflexible array member in union", x); + TREE_TYPE (x) = error_mark_node; + } else if (TREE_CHAIN (x) != NULL_TREE) - error ("%Jflexible array member not at end of struct", x); + { + error ("%Jflexible array member not at end of struct", x); + TREE_TYPE (x) = error_mark_node; + } else if (! saw_named_field) - error ("%Jflexible array member in otherwise empty struct", x); + { + error ("%Jflexible array member in otherwise empty struct", x); + TREE_TYPE (x) = error_mark_node; + } } if (pedantic && TREE_CODE (t) == RECORD_TYPE |