philnik777 wrote:

> > * We check whether two pointers are in the same range
> > 
> > Is that possible to implement in the interpreter without going back to AST 
> > visitors?
> 
> I take "in the same range" meaning as "can be compared at compile time at 
> all" here, so yes, that would be rather trivial (we have to do the check 
> already anyway of course).

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)`.

> Note that of the two use cases you mentioned here, neither works with the 
> code in this PR. :(

That's not great :(. We can of course use new builtins (which is probably a 
good idea anyway), but I don't know how long you support older libc++ versions 
usually. I think it should be possible to add support for these cases though, 
right? We're just doing comparisons or checking whether it's possible to read a 
variable.

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