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

--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Richard Biener from comment #1)
> Hmm, but as you say there isn't an actual access and taking the address of
> one-after the array is allowed.  With p[2] it appropriately warns.

No, what I'm saying is:
* There isn't an actual access, which seems to be the reason why GCC does not
warn.
* But even though there isn't an actual access, the operation is explicitly
forbidden by the C standard (the end of 6.5.6p8), so that GCC should warn
anyway.

Note also that the end of 6.5.6p8 is not the only part of the C standard that
is concerned. According to 6.5.3.2p4, the unary * operator can be used only
when the operand points to a function or to an object (and it doesn't matter
whether there is an access or not). But past the end of an array, there isn't
necessarily an object.

Reply via email to