aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-11-23 11:24:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-11-23 11:24:55 +0000
commitefb71232412323c504f3af95ed6679abfd15cb7a (patch)
treea697ff65416b8a61c02dab5a71350e0bd9eabab7 /gcc/tree.c
parenta5bb8a5ceae1bfb0fa82a58254a6539c8943d4b8 (diff)
downloadgcc-efb71232412323c504f3af95ed6679abfd15cb7a.zip
gcc-efb71232412323c504f3af95ed6679abfd15cb7a.tar.gz
gcc-efb71232412323c504f3af95ed6679abfd15cb7a.tar.bz2
re PR lto/78472 (warning: type of 's' does not match original declaration from zero length bitfield in C vs C++)
2016-11-23 Richard Biener <rguenther@suse.de> PR lto/78472 * tree.c (gimple_canonical_types_compatible_p): Ignore zero-sized fields. lto/ * lto.c (hash_canonical_type): Ignore zero-sized fields. * g++.dg/lto/pr78472_0.c: New testcase. * g++.dg/lto/pr78472_1.C: Likewise. From-SVN: r242746
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 9b0b806..80675db 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13708,10 +13708,14 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
f1 || f2;
f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
{
- /* Skip non-fields. */
- while (f1 && TREE_CODE (f1) != FIELD_DECL)
+ /* Skip non-fields and zero-sized fields. */
+ while (f1 && (TREE_CODE (f1) != FIELD_DECL
+ || (DECL_SIZE (f1)
+ && integer_zerop (DECL_SIZE (f1)))))
f1 = TREE_CHAIN (f1);
- while (f2 && TREE_CODE (f2) != FIELD_DECL)
+ while (f2 && (TREE_CODE (f2) != FIELD_DECL
+ || (DECL_SIZE (f2)
+ && integer_zerop (DECL_SIZE (f2)))))
f2 = TREE_CHAIN (f2);
if (!f1 || !f2)
break;