It looks like it might be a targets problem, as I only see it with -targets ppu-unknown-lv2:<br> <br>File:<br> <br>long long value = 0LL;<br> <br>Command line:<br> <br>clang -cc1 -targets ppu-unknown-lv2 file.cpp<br> <br>Any idea?<br>
 <br>-John<br><br>
<div class="gmail_quote">On Wed, Apr 28, 2010 at 1:20 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div style="WORD-WRAP: break-word"><br>
<div>
<div class="im">
<div>On Apr 21, 2010, at 3:35 PM, John Thompson wrote:</div><br>
<blockquote type="cite">
<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></blockquote>

<div><br></div></div>Hi John,</div>
<div><br></div>
<div>I don't understand why this is a bug, can you give a testcase?</div>
<div><br>
<blockquote type="cite">
<div>
<div></div>
<div class="h5">
<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></div></div>_______________________________________________<br>cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></blockquote>
</div><br></div></blockquote></div><br><br clear="all"><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>