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 Tue, 7 Feb 2012, Jonathan Wakely wrote:

> Hi Richard,
> 
> re http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00280.html (I'm not
> subscribed to gcc-patches so only read it in the archive)
> 
> > Note that in the above case
> > tail-padding is _not_ reused (for some reason).
> 
> Tail-padding in PODs can't be reused according to the ABI.  Give Base
> a user-defined constructor or destructor and it gets reused.

Ah, thanks.  Thus, for the following testcase

struct Base {
    Base();
    int i : 1;
};
struct Deriv : Base {
    char d : 2;
    char x;
};

Deriv s;
void foo ()
{
  s.i = 1;
  s.d = 2;
  s.x = 3;
}

What does the C++ memory model say about accesses to s.i, s.d and s.x?
What would it have said for -fabi-version=1 where for 
we place s.i and s.d into the same byte?

Thanks,
Richard.


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