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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-02-02
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We have stuff in place to catch this for ops like divisions (to not
hoist sth that could trap) but we do not do this for loads (also for the
reason a conservative answer here is very pessimizing).

Note that for whatever reason it doesn't trigger if you remove 'static' from
the
array.  It seems to rely on the fact of IPA reference making the array
TREE_READONLY.  And it then relies on other passes _not_ constant folding
the read to zero (likely some tree_fits_uhwi restriction in constant
folding...).

When removing the initializer I also get

t.c:1:11: warning: array ā€˜d’ assumed to have one element
 const int d[][8];
           ^

but only for non-static d...

Reply via email to