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

Jordy Rose jediknil at belkadan.com
Mon Jun 14 22:11:16 PDT 2010


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?



More information about the cfe-commits mailing list