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

Jordan Rose jordan_rose at apple.com
Wed Aug 20 10:08:18 PDT 2014


Ah, thanks for the explanation. I wonder if this means we should be checking expression types earlier, but meanwhile we might as well be safe. Committed as r216076!

Jordan


On Aug 19, 2014, at 6:55 , Anders Rönnholm <Anders.Ronnholm at evidente.se> wrote:

> 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
> 
> //Anders
> 
> ________________________________________
> 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.
> 
> Jordan
> 
> 
> 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
> <bug-20659.diff>





More information about the cfe-commits mailing list