http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60861
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Yury Gribov from comment #3) > I can reproduce this in trunk. Looks like Asan pass works correctly but gcc > reduces test() to 'return 1;' very early for some reason. I'll debug further. Most likely due to GCC optimizing the code as it knows the only value it could be is 1. Try it with a two element constant array and you most likely get the result you want.