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: Memory corruption due to word sharing


On 02/07/2012 05:32 AM, Aldy Hernandez wrote:
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;
};

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

That's my understanding as well.


Jason


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