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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
6.5.6 p8 covers it. You cannot increment or decrement a pointer past the end of
an array (except the one past the end position). C++ has similar rules. GCC
assumes there is no object at address zero, see the documentation for
-fdelete-null-pointer-checks

Since there is no object at address zero, the first possible byte that can be
part of an array of bytes is address 1, and so decrementing a pointer to that
byte would point to an element at index -1, which doesn't exist (this violates
the "if the array is large enough" wording of 6.5.6 p8, because you've gone out
of bounds of the array).

Reply via email to