diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-12-30 18:24:03 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-12-30 18:24:03 +0000 |
commit | b3c1008c101ec8a23d60a01c8038a644b0657a60 (patch) | |
tree | 898830c9b66436ffd54795f64963d3607f64c897 /gcc/c-decl.c | |
parent | 08b2ba302b753810b42419f77415a77e16262901 (diff) | |
download | gcc-b3c1008c101ec8a23d60a01c8038a644b0657a60.zip gcc-b3c1008c101ec8a23d60a01c8038a644b0657a60.tar.gz gcc-b3c1008c101ec8a23d60a01c8038a644b0657a60.tar.bz2 |
re PR c/46889 (Missing diagnosis on duplicate struct member with anonymous union)
PR c/46889
* c-decl.c (detect_field_duplicates): Ensure hash is used for
finding duplicates when first field is anonymous.
testsuite:
* gcc.dg/anon-struct-15.c: New test.
From-SVN: r168348
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 40fccbe..4d24c60 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6805,11 +6805,9 @@ detect_field_duplicates (tree fieldlist) /* First, see if there are more than "a few" fields. This is trivially true if there are zero or one fields. */ - if (!fieldlist) - return; - x = DECL_CHAIN (fieldlist); - if (!x) + if (!fieldlist || !DECL_CHAIN (fieldlist)) return; + x = fieldlist; do { timeout--; if (DECL_NAME (x) == NULL_TREE |