[Bug middle-end/91946] wrong result comparing pointer with pointer+offset with -m32

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 1 10:12:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91946

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
You can use -fwrapv-pointer to make pointer-wrapping defined.

In C you are only allowed to use relational compares on pointers to the same
object.  On x86-linux there is no valid object at address zero thus an
object cannot start at 0xf3e0080c and be of your size, wrapping around
(and including) zero.

The optimization that is performed is rewriting a > a + n as 0 > n which
is quite useful in other contexts.


More information about the Gcc-bugs mailing list