[Bug tree-optimization/87901] partial DSE of memset doesn't work for other kind of stores

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 6 17:50:00 GMT 2018


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?


More information about the Gcc-bugs mailing list