On Thu, 30 Jun 2016, Richard Biener wrote:
points-to analysis already has the constraint that POINTER_PLUS_EXPR
cannot leave the object op0 points to. Of course currently nothing uses
the fact whether points-to computes pointed-to as nothing (aka NULL) -
so the argument may be moot.
Anyway, one of my points to the original patch was that POINTER_PLUS_EXPR
handling should be clearly separate from PLUS_EXPR and that we have
flag_delete_null_pointer_checks to allow targest to declare that 0 is a valid
object pointer (and thus you can do 4 + -4 and reach NULL).
Thanks. So the tricky point is that we are not allowed to transform g into
f below:
char*f(char*p){return p+4;}
char*g(char*p){return (char*)((intptr_t)p+4);}
That makes sense and seems much easier to guarantee than I feared, nice.
(on the other hand, only RTL is able to simplify (long)p+4-(long)(p+4))
--
Marc Glisse