[cfe-commits] [patch] Tracking simple arithmetic constraints (PR2695)

Ted Kremenek kremenek at apple.com
Mon Jun 14 22:30:14 PDT 2010


On Jun 14, 2010, at 10:11 PM, Jordy Rose wrote:

> 
> On Mon, 14 Jun 2010 21:45:15 -0700, Ted Kremenek <kremenek at apple.com>
> wrote:
>> Hi Jordy,
>> 
>> I am combing through the patch.  I had a quick question.  Regarding:
>> 
>> const GRState*
>> RangeConstraintManager::AssumeSymLT(const GRState* state, SymbolRef sym,
>>                                    const llvm::APSInt& Int,
>>                                    const llvm::APSInt& Adjustment) {
>>  ...
>>  // Special case for Int == Min. This is always false.
>>  if (Int == Min)
>>    return NULL;
>> 
>>  llvm::APSInt Lower = Min-Adjustment;
>>  llvm::APSInt Upper = Int-Adjustment;
>> 
>> 
>> Are you assuming that APSInt handles overflow semantics here? 
>> Specifically, can't 'Min - Adjustment' overflow?  Same with 'Int -
>> Adjustment'.
> 
> Yes, I am assuming that. The logic below makes sure these are used
> correctly whether or not they overflow.
> 
> Is that not a safe assumption to make about APSInt?

I think so, but it is worth testing.




More information about the cfe-commits mailing list