https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70393
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nathan at gcc dot gnu.org
--- Comment #5 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
We're turning 'ab's initializer into a static one (so the lack of a dynamic
initializer is a red herring). But we're flubbing the form of that initializer
because the placement of AB's bases is not their declaration order. B is
chosen as the primary base, so AB is laid out as:
AB size 24 align 8
A @ 16
B @ 0
The emitted initializer is:
_ZL2ab:
.zero 16
.long 1 <-- A::a
.quad _ZTV2AB+16
.quad 2 <-- B::element
(I modified the testcase so the NSDMIs are distinct non-zero values). The 16
zero bytes appear to be skipping over the B sub-object to place A's
initializer.
We should be emitting something more like:
_ZL2ab:
.quad _ZTV2AB+16
.quad 2 <--B::element
.long 1 <-- A::a
.zero 4 <-- tail padding