2.4.II.2

Mark Mitchell mark at codesourcery.com
Thu Oct 19 17:42:59 UTC 2000


This section (on laying out bases/fields) is still not right in the
case where the thing being laid out is a field.  Basically, this
section doesn't take into account that for fields you lay out the
virtual bases, too.

In particular, 

  Otherwise, if D is not an empty base class (including all data
  members), start at offset dsize(C), incremented if necessary for
  alignment to nvalign(type(D)) for base classes or to align(type(D))
  for data members. Place D at this offset unless doing so would result
  in two components (direct or indirect) of the same type having the
  same offset. If such a component type conflict occurs, increment the
  candidate offset by nvalign(type(D)), and try again, repeating until
  success occurs (which will occur no later than sizeof(C) rounded up to
  the required alignment).

In this paragraph, both occurrences of `nvalign' are wrong for fields;
they should be `align' in that case.

     Update sizeof(C) to max (sizeof(C), offset(D)+nvsize(D)). Update
     align(C) to max (align(C), nvalign(D)). If D is a base class (not
     empty in this case), update dsize(C) to offset(D)+nvsize(D). If D
     is a data member, update dsize(C) to max (offset(D)+dsize(D),
     offset(D)+1).

Similarly, the occurrences of `nvsize' in this section should be size
in this case.  Perhaps we could parameterize this section by making
`s' and `a' definitions at the beginning that are nvsize/sizeof and
nvalign/align appropriately.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list