This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][4.8] C++ memory model bitfield handling rewrite


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
like

struct 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]