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

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

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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The example is undefined -- it forms a past the-end pointer -- and
-Warray-bounds detects it:

warning: array subscript 2 is outside array bounds of ‘int[1]’ [-Warray-bounds]
    6 |   *((short *)&i + sizeof (int) - sizeof (short)) = 1;

I don't suppose you meant to do that, but presumably meant to access a part of
the object.  But even then the code is undefined.

Can you explain/clarify what you have in mind and why it's important?

Reply via email to