<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style title="owaParaStyle"><!--P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">Hi all,</font></div>
<div dir="ltr"><font size="2" face="Tahoma"></font> </div>
<div dir="ltr"><font size="2" face="Tahoma">I checked "VisitInitListExpr(InitListExpr *ILE)" function and found strange type checking order. Current type checking order is as following.</font></div>
<div dir="ltr"><font size="2" face="Tahoma"></font> </div>
<div dir="ltr"><font size="2" face="Tahoma"> 829 llvm::Constant *VisitInitListExpr(InitListExpr *ILE) {<br>
830 if (ILE->getType()->isArrayType())<br>
831 return EmitArrayInitialization(ILE);<br>
832<br>
833 if (ILE->getType()->isRecordType())<br>
834 return EmitUnionInitialization(ILE);<br>
835<br>
836 if (ILE->getType()->isUnionType())<br>
837 return EmitStructInitialization(ILE);<br>
</font></div>
<div dir="ltr"><font size="2" face="Tahoma"><font face="tahoma">If RecodeType is checked eariler, UnionType will not be check because UnionType is checked from Decl's field and Type is also RecordType. Although EmitStructInitialization() and EmitUnionInitialization()
call the same ConstStructBuilder::BuildStruct() function, It looks like wrong. I think UnionType should be checked eariler than RecordType.</font></font></div>
<div dir="ltr"><font size="2" face="Tahoma"><font face="tahoma"></font></font> </div>
<div dir="ltr"><font size="2" face="Tahoma">What do you think about this?</font></div>
<div dir="ltr"><font size="2" face="Tahoma"></font> </div>
<div dir="ltr"><font size="2" face="Tahoma">I attach a simple patch to fix it.</font></div>
<div dir="ltr"><font size="2" face="Tahoma"></font> </div>
<div dir="ltr"><font size="2" face="Tahoma">Regards,</font></div>
<div dir="ltr"><font size="2" face="Tahoma">Jin-Gu Kang</font></div>
</body>
</html>