Testcase is for example g++.dg/abi/bitfield5.C, bit layout annotated:

struct A {
   virtual void f();
   int f1 : 1;<--- bit 64
};

struct B : public A {
   int f2 : 1;  // { dg-warning "ABI" }<--- bit 65
   int : 0;
   int f3 : 4;
   int f4 : 3;
};

maybe it was a bug (above happens with -fabi-version=1 only),
but certainly an ABI may specify that we should do that packing.

What does the C++ memory model say here?  (incidentially that's
one case I was worried about when reviewing your patches,
just I didn't think of _bitfield_ tail-packing ... ;)).

I suppose I could just force the bitfield region to start
at a byte boundary.

I think we talked about this months ago when working on the memory model stuff. Andrew Macleod brought it up, but I can't find the thread.

It is my understanding that f1 and f2 must be in distinct memory regions. So writing to f1 cannot clobber f2.

I would like to get confirmation from Jason though.

Reply via email to