https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66090
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Since the pointer is wrapping to null, you need to use
-fno-delete-null-pointer-checks to disable removing of checks of null pointers
or rather it enables allowing pointers to wrap to become null.
In C, once a pointer is non-null, it can't become null by adding a value to it.
So GCC enables an optimization around that case (and
fno-delete-null-pointer-checks disables that optimization).
So no GCC bug, just wrongly assuming pointers can't become null pointers if
they were not null pointers.