------- Comment #6 from rguenth at gcc dot gnu dot org 2009-10-08 15:07 ------- With 4.3 and 4.4 it is SRA that does not avoid generating wrong code, with 4.5 SRA optimizes the code correctly and recognizes both forms access the same memory (and thus we optimize the program to return 0).
Workaround: -fno-tree-sra -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41630