[Bug c/88367] [9 Regression] -fno-delete-null-pointer-checks doesn't work properly

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 6 08:44:00 GMT 2018


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think even the old

          if (range_is_nonnull (&vr0) || range_is_nonnull (&vr1))
            set_value_range_to_nonnull (vr, expr_type);

code is wrong with -fno-delete-null-pointer-checks (which is overloaded with
the case that address zero is a valid pointer to an object).  So IMHO you
can simplify the patch and guard the affected places with
flag_delete_null_pointer_checks.

Strictly the kernel case of computing NULL - 24 invokes UB and needs
-fwrapv-pointer (but IIRC the kernel uses -fno-strict-overflow which
enables that already).  I don't think we exploint wrapping UB for
pointers in the VRP case though.


More information about the Gcc-bugs mailing list