Question about tail padding

mendell at ca.ibm.com mendell at ca.ibm.com
Thu Aug 15 16:32:03 UTC 2002


With allocation of derived classes in tail padding, what happens in the
following case

  struct S1 {
    virtual void f();
    int i;
    char c1;
  };                    // sizeof (S1) == 16 in 64 bit mode

  struct S2 : public S1 {
    char c2;            // allocated next to c1
  };                    // sizeof (S2) == 16 in 64 bit mode

S2 s2;
S1& rs1 = &s2;
S1 s1;

rs1 = s1;  // this will clobber the char member of s2.

Is this a reasonable interpretation?  Doesn't the assignment of S1s copy
the tail padding?

Mark Mendell
IBM Canada




More information about the cxx-abi-dev mailing list