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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Because the standards (both C and C++) say that &a[1] is valid.
E.g. in ISO C99, 6.5.6/8
"If both the pointer
operand and the result point to elements of the same array object, or one past
the last
element of the array object, the evaluation shall not produce an overflow;
otherwise, the
behavior is undefined. If the result points one past the last element of the
array object, it
shall not be used as the operand of a unary * operator that is evaluated."
&a[1] is valid, a[1] is not valid for an array with a single element.

Reply via email to