<div>I'm getting a couple of asserts, one from the assert in Sema::ActOnNumericConstant at line 1897, the other in a separate case in the APInt::trunc call because the argument is bigger than the width.</div>
<div> </div>
<div>These two changes seem to avoid the asserts, I'm not sure it's the right fix:</div>
<div> </div>
<div>Index: lib/Sema/SemaExpr.cpp<br>===================================================================<br>--- lib/Sema/SemaExpr.cpp (revision 102026)<br>+++ lib/Sema/SemaExpr.cpp (working copy)<br>@@ -1885,7 +1885,10 @@<br>
Diag(Tok.getLocation(), diag::ext_longlong);<br> <br> // Get the value in the widest-possible width.<br>- llvm::APInt ResultVal(Context.Target.getIntMaxTWidth(), 0);<br>+ llvm::APInt ResultVal(<br>+ Literal.isLongLong ?<br>
+ Context.Target.getLongLongWidth() :<br>+ Context.Target.getIntMaxTWidth(), 0);<br> <br> if (Literal.GetIntegerValue(ResultVal)) {<br> // If this value didn't fit into uintmax_t, warn and force to ull.<br>
@@ -1956,8 +1959,12 @@<br> Width = Context.Target.getLongLongWidth();<br> }<br> <br>- if (ResultVal.getBitWidth() != Width)<br>- ResultVal.trunc(Width);<br>+ if (ResultVal.getBitWidth() != Width) {<br>
+ if (Literal.isUnsigned)<br>+ ResultVal.zextOrTrunc(Width);<br>+ else<br>+ ResultVal.sextOrTrunc(Width);<br>+ }<br> }<br> Res = new (Context) IntegerLiteral(ResultVal, Ty, Tok.getLocation());<br>
}<br> </div>
<div> </div>
<div>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a><br><br></div>