diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-04-27 01:47:06 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2005-04-27 01:47:06 +0100 |
commit | eb3490b96c149c8a5559b3f3947257c4ce0df650 (patch) | |
tree | cf0c6299cc325166c5334689a7def45d807128fa /gcc/c-decl.c | |
parent | 968744fc6609f4efdadb4272ac895d1e15867c77 (diff) | |
download | gcc-eb3490b96c149c8a5559b3f3947257c4ce0df650.zip gcc-eb3490b96c149c8a5559b3f3947257c4ce0df650.tar.gz gcc-eb3490b96c149c8a5559b3f3947257c4ce0df650.tar.bz2 |
re PR c/21213 (segfault declaring a transparent union)
PR c/21213
* c-decl.c (finish_struct): Don't dereference NULL TYPE_FIELDS of
transparent union.
testsuite:
* gcc.dg/transparent-union-3.c: New test.
From-SVN: r98808
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b1309b3..3578862 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5329,7 +5329,7 @@ finish_struct (tree t, tree fieldlist, tree attributes) make it one, warn and turn off the flag. */ if (TREE_CODE (t) == UNION_TYPE && TYPE_TRANSPARENT_UNION (t) - && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))) + && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))) { TYPE_TRANSPARENT_UNION (t) = 0; warning (0, "union cannot be made transparent"); |