[cfe-dev] asserts
John Thompson
john.thompson.jtsoftware at gmail.com
Wed Apr 28 18:01:40 PDT 2010
It looks like it might be a targets problem, as I only see it with -targets
ppu-unknown-lv2:
File:
long long value = 0LL;
Command line:
clang -cc1 -targets ppu-unknown-lv2 file.cpp
Any idea?
-John
On Wed, Apr 28, 2010 at 1:20 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Apr 21, 2010, at 3:35 PM, John Thompson wrote:
>
> 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.
>
>
> Hi John,
>
> I don't understand why this is a bug, can you give a testcase?
>
>
> These two changes seem to avoid the asserts, I'm not sure it's the right
> fix:
>
> Index: lib/Sema/SemaExpr.cpp
> ===================================================================
> --- lib/Sema/SemaExpr.cpp (revision 102026)
> +++ lib/Sema/SemaExpr.cpp (working copy)
> @@ -1885,7 +1885,10 @@
> Diag(Tok.getLocation(), diag::ext_longlong);
>
> // Get the value in the widest-possible width.
> - llvm::APInt ResultVal(Context.Target.getIntMaxTWidth(), 0);
> + llvm::APInt ResultVal(
> + Literal.isLongLong ?
> + Context.Target.getLongLongWidth() :
> + Context.Target.getIntMaxTWidth(), 0);
>
> if (Literal.GetIntegerValue(ResultVal)) {
> // If this value didn't fit into uintmax_t, warn and force to ull.
> @@ -1956,8 +1959,12 @@
> Width = Context.Target.getLongLongWidth();
> }
>
> - if (ResultVal.getBitWidth() != Width)
> - ResultVal.trunc(Width);
> + if (ResultVal.getBitWidth() != Width) {
> + if (Literal.isUnsigned)
> + ResultVal.zextOrTrunc(Width);
> + else
> + ResultVal.sextOrTrunc(Width);
> + }
> }
> Res = new (Context) IntegerLiteral(ResultVal, Ty, Tok.getLocation());
> }
>
>
> --
> John Thompson
> John.Thompson.JTSoftware at gmail.com
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
--
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100428/7929a05e/attachment.html>
More information about the cfe-dev
mailing list