[LLVMdev] Question about NoWrap flag for SCEVAddRecExpr

Adam Nemet anemet at apple.com
Thu Jun 11 00:02:23 PDT 2015


> On Jun 10, 2015, at 11:44 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
>> Base is treated as unsigned so 0xff…ff + 1 would be 0x100…00
> 
> This is the part I was missing, thanks for pointing out the FAQ.  So
> the infinitely precise address computed by a GEP is
> 
> zext(Base) + sext(Idx0) + sext(Idx1) … ?

Yes, that is the way I read it.

>> 0x100…00 which would be out of bounds (sort of).
> 
> Does this mean, for C++ programs of the form,
> 
>  for (int *I = array, *E = array + size; I != E; ++I)
>   ...
> 
> the memory allocator has to guarantee that array cannot span
> [0xff..fffff-31,0xff..fffff] (both inclusive) with size == 32?

I think so.  Address 0 cannot be dereferenced, so you can’t have a valid object spanning across address 0.

Adam

> 
> -- Sanjoy





More information about the llvm-dev mailing list