[Bug c++/103780] zero pointer is considered true

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 20 20:03:20 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>a pointer that goes to 0 after decrement is still considered true.

Yes a pointer is never a null pointer if it is decremented and it was a valid
pointer to begin with.

Use -fno-delete-null-pointer-checks if you want to disable this optimization.


More information about the Gcc-bugs mailing list