[PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere
Richard Guenther
rguenther@suse.de
Mon Mar 26 08:52:00 GMT 2012
On Mon, 26 Mar 2012, Eric Botcazou wrote:
> > I think we indeed can't really in stor-layout, so the only place is very
> > likely get_bit_range.
>
> Something like that for example. I think the expmed.c hunk should be applied
> to the 4.7 branch as well, because the new code in store_bit_field is quite
> dangerous without it.
>
>
> * expmed.c (store_bit_field): Assert that BITREGION_START is a multiple
> of a unit before computing the offset in units.
> * expr.c (get_bit_range): Return the null range if the enclosing record
> is part of a larger bit field.
The patch looks reasonable - can we compute this backward from the
result of the outer get_inner_reference call and the outermost
field-decl though? Or make get_inner_reference compute that while
analyzing the full reference and return a flag? OTOH it shouldn't
be too expensive.
I agree the assert should go to the banch as well, though the code
only ever triggers there with --param allow-store-data-races=0.
Thanks,
Richard.
More information about the Gcc-patches
mailing list