[PATCH] fix bug 20659 ICE in alpha.core.IdenticalExpr

Anders Rönnholm Anders.Ronnholm at evidente.se
Tue Aug 19 06:55:13 PDT 2014

The ast-dump looks like below. The bug occurs when an assert in the comparison operator of APInt is triggered between `-IntegerLiteral 0x56924a8 <col:9> 'int' 0 and `-IntegerLiteral 0x56bfba0 <col:9> 'unsigned long' 18446744073709551615  

APInt.h:969: bool llvm::APInt::operator==(const llvm::APInt&) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed.

I don't know of a better fix than to check that the bitwidths are equal.

    | | `-BinaryOperator 0x56924e0 <line:7:5, col:9> 'long' '='
    | |   |-DeclRefExpr 0x5692480 <col:5> 'long' lvalue Var 0x5692220 'c' 'long'
    | |   `-ImplicitCastExpr 0x56924c8 <col:9> 'long' <IntegralCast>
    | |     `-IntegerLiteral 0x56924a8 <col:9> 'int' 0
    | `-CompoundStmt 0x56bfc00 <line:8:10, line:11:3>
    |   |-CompoundAssignOperator 0x56bfb40 <line:9:5, col:10> 'int' '-=' ComputeLHSTy='int' ComputeResultTy='int'
    |   | |-DeclRefExpr 0x5692530 <col:5> 'int' lvalue Var 0x56921a0 'b' 'int'
    |   | `-ImplicitCastExpr 0x56bfb28 <col:10> 'int' <LValueToRValue>
    |   |   `-DeclRefExpr 0x56bfb00 <col:10> 'int' lvalue Var 0x5692130 'a' 'int'
    |   `-BinaryOperator 0x56bfbd8 <line:10:5, col:9> 'long' '='
    |     |-DeclRefExpr 0x56bfb78 <col:5> 'long' lvalue Var 0x5692220 'c' 'long'
    |     `-ImplicitCastExpr 0x56bfbc0 <col:9> 'long' <IntegralCast>
    |       `-IntegerLiteral 0x56bfba0 <col:9> 'unsigned long' 18446744073709551615


Från: Jordan Rose [jordan_rose at apple.com]
Skickat: den 18 augusti 2014 18:36
Till: Anders Rönnholm
Cc: cfe-commits at cs.uiuc.edu
Ämne: Re: [PATCH] fix bug 20659 ICE in alpha.core.IdenticalExpr

Thanks for getting to this so quickly. However, I kind of thought C doesn't ever allow this—any comparisons between two values should always have already implicitly converted one type to the other. Is this because we're looking through casts?

If you're sure this is the right fix (and not, say, somewhere else in the analyzer), please add a reduced test case as well.


On Aug 18, 2014, at 1:18 , Anders Rönnholm <Anders.Ronnholm at evidente.se> wrote:

> Hi,
> Fix for reported bug 20659 in identicalexpression.
> //Anders
> <bug-20659.diff>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-20659.diff
Type: text/x-patch
Size: 1288 bytes
Desc: bug-20659.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140819/e169e7a1/attachment.bin>

More information about the cfe-commits mailing list