philnik777 wrote:

> > Yes, that's the interesting question. Currently we assume that if 
> > __builtin_constant_p(__begin <= __ptr && __ptr < __end) is false, __ptr 
> > can't be within the the range [__begin, __ptr).
> 
> Thinking about this some more, I'm not sure if this is even true. 
> `__builtin_constant_p` will return `true` if that comparison can be folded, 
> it doesn't matter if the result of the comparison is true or not: 
> https://godbolt.org/z/fchbK977T

I think you're missing an important thing: If `__builtin_constant_p` is true we 
do _not_ assume that the pointer is in fact in range. If `__builtin_constant_p` 
is true, we _only_ assume that we are allowed to compare the pointers.


https://github.com/llvm/llvm-project/pull/122099
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to