On 02/07/2012 02:23 AM, Richard Guenther wrote:
There are still corner-cases I also pointed out in the existing get_bit_range code, namely if you consider tail-padding re-use with C++ inheritance (I didn't try hard to construct a testcase yet). The C++ memory model folks have not yet expressed their opinion as to how this case is supposed to be handled - a testcase would look likestruct Base { int i : 1; }; struct Deriv : Base { char c; }; where Deriv::c would be at byte offset 1 (the current code will allow SImode accesses to Base:i). Note that in the above case tail-padding is _not_ reused (for some reason).
We don't re-use the tail padding of Base because it is a POD-struct. Adding a user-defined constructor, copy assignment operator or destructor should make it non-POD and therefore enable tail padding reuse.
i and c are separate memory locations. Jason
