<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi, <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>     I have posted a potential bug as <a href="http://llvm.org/bugs/show_bug.cgi?id=11751">http://llvm.org/bugs/show_bug.cgi?id=11751</a><o:p></o:p></p><p class=MsoNormal>And a potential fix for the bug. The attachment t.c is the file to reduce the assertion<o:p></o:p></p><p class=MsoNormal>And please compile clang with –enable-assertion.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This assertion in CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const<o:p></o:p></p><p class=MsoNormal>RecordDecl *D, llvm::StructType *Ty) bothers Peren test. It makes it failed.<o:p></o:p></p><p class=MsoNormal>This assertion tried to compute the size of BaseTy of a layout's non virtual<o:p></o:p></p><p class=MsoNormal>size. However, the real code has modified the BaseTy before assertion. So I<o:p></o:p></p><p class=MsoNormal>added a recompution of the real BaseTy in assert test segment <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>...<o:p></o:p></p><p class=MsoNormal>  // If we're in C++, compute the base subobject type.<o:p></o:p></p><p class=MsoNormal>  llvm::StructType *BaseTy = 0;<o:p></o:p></p><p class=MsoNormal>  if (isa<CXXRecordDecl>(D)) {<o:p></o:p></p><p class=MsoNormal>    BaseTy = Builder.BaseSubobjectType;<o:p></o:p></p><p class=MsoNormal>    if (!BaseTy) BaseTy = Ty;   <--- is not BaseTy anymore if BaseTy is NULL<o:p></o:p></p><p class=MsoNormal>  }<o:p></o:p></p><p class=MsoNormal>...<o:p></o:p></p><p class=MsoNormal>#ifndef NDEBUG<o:p></o:p></p><p class=MsoNormal>  // Verify that the computed LLVM struct size matches the AST layout size.<o:p></o:p></p><p class=MsoNormal>  const ASTRecordLayout &Layout = getContext().getASTRecordLayout(D);<o:p></o:p></p><p class=MsoNormal>...<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>  if (BaseTy) {  <-- this requires the true BaseTy<o:p></o:p></p><p class=MsoNormal>    CharUnits NonVirtualSize  = Layout.getNonVirtualSize();<o:p></o:p></p><p class=MsoNormal>    CharUnits NonVirtualAlign = Layout.getNonVirtualAlign();<o:p></o:p></p><p class=MsoNormal>    CharUnits AlignedNonVirtualTypeSize = <o:p></o:p></p><p class=MsoNormal>      NonVirtualSize.RoundUpToAlignment(NonVirtualAlign);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>    uint64_t AlignedNonVirtualTypeSizeInBits = <o:p></o:p></p><p class=MsoNormal>      getContext().toBits(AlignedNonVirtualTypeSize);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>    assert(AlignedNonVirtualTypeSizeInBits == <o:p></o:p></p><p class=MsoNormal>           getTargetData().getTypeAllocSizeInBits(BaseTy) &&<o:p></o:p></p><p class=MsoNormal>           "Type size mismatch!");<o:p></o:p></p><p class=MsoNormal>  }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My potential fix is to recompute the BaseTy in the assertion segment to deal with this problem. (as<o:p></o:p></p><p class=MsoNormal>Clang.diff)  I have run both cross and simple cross test validation with this change. No new failure is <o:p></o:p></p><p class=MsoNormal>introduced. (report.txt and test.report). Please give a review, Thanks.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                                  Yin <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>