r196602 - [MS-ABI] Fix alias-avoidance padding between bases

Warren Hunt whunt at google.com
Fri Dec 6 16:19:29 PST 2013


Addressed in: 196627


On Fri, Dec 6, 2013 at 4:02 PM, Hans Wennborg <hans at chromium.org> wrote:

> Hi Warren,
>
> On Fri, Dec 6, 2013 at 11:54 AM, Warren Hunt <whunt at google.com> wrote:
> > Author: whunt
> > Date: Fri Dec  6 13:54:25 2013
> > New Revision: 196602
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=196602&view=rev
> > Log:
> > [MS-ABI] Fix alias-avoidance padding between bases
> >
> > Adds padding between bases or virtual bases in an attempt to avoid
> > aliasing of zero-sized sub-objects.  The approach used by the ABI adds
> > two more bits of state.  Detailed comments are in the code.  Test cases
> > included.
> >
> > Differential Revision: http://llvm-reviews.chandlerc.com/D2258
> >
> >
> > Added:
> >     cfe/trunk/test/Layout/ms-x86-alias-avoidance-padding.cpp
> > Modified:
> >     cfe/trunk/include/clang/AST/RecordLayout.h
> >     cfe/trunk/lib/AST/RecordLayout.cpp
> >     cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
> >
> > Modified: cfe/trunk/include/clang/AST/RecordLayout.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecordLayout.h?rev=196602&r1=196601&r2=196602&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/include/clang/AST/RecordLayout.h (original)
> > +++ cfe/trunk/include/clang/AST/RecordLayout.h Fri Dec  6 13:54:25 2013
> > @@ -104,6 +104,14 @@ private:
> >      /// a primary base class.
> >      bool HasExtendableVFPtr : 1;
> >
> > +    /// HasZeroSizedSubObject - True if this class contains a zero
> sized member or base or a base
> > +    /// with a zero sized member or base.  Only used for MS-ABI.
> > +    bool HasZeroSizedSubObject : 1;
> > +
> > +    /// \brief True if this class is zero sized or first base is zero
> sized or
> > +    /// has this property.  Only used for MS-ABI.
> > +    bool LeadsWithZeroSizedBase : 1;
> > +
> >      /// PrimaryBase - The primary base info for this record.
> >      llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> PrimaryBase;
> >
> > @@ -145,6 +153,8 @@ private:
> >                    const CXXRecordDecl *PrimaryBase,
> >                    bool IsPrimaryBaseVirtual,
> >                    const CXXRecordDecl *BaseSharingVBPtr,
> > +                  bool HasZeroSizedSubObject,
> > +                  bool LeadsWithZeroSizedBase,
> >                    const BaseOffsetsMapTy& BaseOffsets,
> >                    const VBaseOffsetsMapTy& VBaseOffsets);
> >
> > @@ -272,6 +282,16 @@ public:
> >      return RequiredAlignment;
> >    }
> >
> > +  bool hasZeroSizedSubObject() const {
> > +    assert(CXXInfo && "Record layout does not have C++ specific info!");
>
> I'm hitting this assert when trying to run the test suite with the
> microsoft ABI instead of itanium. For example in these tests:
> CodeGen/2002-07-14-MiscTests3.c CodeGen/2002-07-30-UnionTest.c
>
> Any ideas what could cause this?
>
> Thanks,
> Hans
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131206/aeb79dd7/attachment.html>


More information about the cfe-commits mailing list