[PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere

Richard Guenther rguenther@suse.de
Fri Mar 16 09:42:00 GMT 2012


On Thu, 15 Mar 2012, Eric Botcazou wrote:

> > Computing the offset in stor-layout.c and storing it in DECL_INITIAL?
> 
> Ugh.  I just realized that the DECL_BIT_FIELD_REPRESENTATIVE is built during 
> layout... but is overloaded with DECL_QUALIFIER.  That's probably the source 
> of the miscompilation I talked about earlier.

But it's only ever computed for RECORD_TYPEs where DECL_QUALIFIER is
unused.

> Can we delay it until after gimplification ?  Then we could use DECL_INITIAL.

No, I don't think so.  We can store the bit-offset relative to the
start of the group in tree_base.address_space (ugh), if 8 bits
are enough for that (ugh).

For now giving up seems to be easiest (just give up when
DECL_FIELD_OFFSET is not equal for all of the bitfield members).
That will at most get you the miscompiles for the PRs back, for
languages with funny structure layout.

Well.  I'll think about this some more and in the meantime install
the fix for the easy problem.

Richard.



More information about the Gcc-patches mailing list