[Bug ipa/71207] [5/6/7 Regression] gcc 5.3 and 6.1 generates wrong code with -O2
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 12 15:10:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71207
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamborm at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Problem is caused by fact that we a C++ diamond virtual inheritance and Class1
in included in Class4 just in once. However, contains_type_p is called with
outer_type == Class4, otr_type == Class3 and offset == 192. As Class1 is part
of Class3 it pops up Class3's size and the test wrongly return false.
BINFO is aware of having Class1 included just once:
Class Class4
size=32 align=8
base size=8 base align=8
Class4 (0x0x7fecbda894d0) 0 nearly-empty
vptridx=0 vptr=((& Class4::_ZTV6Class4) + 32)
Class2 (0x0x7fecbda78340) 0 nearly-empty
primary-for Class4 (0x0x7fecbda894d0)
subvttidx=8
Class1 (0x0x7fecbdbdfe40) 8 virtual
vptridx=24 vbaseoffset=-24 vptr=((& Class4::_ZTV6Class4) + 80)
Class3 (0x0x7fecbda783a8) 24 nearly-empty virtual
subvttidx=40 vptridx=32 vbaseoffset=-32 vptr=((& Class4::_ZTV6Class4) +
136)
Class1 (0x0x7fecbdbdfe40) alternative-path
here --^
Before r229859, the condition in contains_type_p was always false as TREE_CODE
(outer_type) == INTEGER_CST was always false.
I'm sending patch candidate and reducing a test-case from Firefox, where the
newly modified condition returns false.
Martin
More information about the Gcc-bugs
mailing list