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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Gabriel Ravier from comment #0)
> PS: This also results in plenty of invalid warnings when compiling with
> -Wall:
> 
> <source>: In function 'f':
> <source>:6:9: warning: array subscript 1 is outside array bounds of 'int[1]'
> [-Warray-bounds]
>     6 |         *p = 2;
>       |         ^~
> <source>:1:12: note: at offset 4 into object 'x' of size 4
>     1 | extern int x[1], y;
>       |            ^

The warning in this case is valid and helpful: it's undefined to attempt to
access an object using a pointer derived from a pointer to an unrelated object
(the equality between pointers to adjacent objects notwithstanding).

Reply via email to