https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63704
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Oh, no. It's actually a genuine bug. __attribute__((optimize("O3"))) enables -fstrict-aliasing, so if the rest of the TU is compiled with -fno-strict-aliasing it depends on prue luck if 'int' (as in this case) gets alias-set zero (a function compiled with -fno-strict-aliasing calls get_alias_set on it) or a non-zero alias-set (the -O3 function calls get_alias_set on 'int'). Of course LTO just makes it more likely to trigger. -> -fstrict-aliasing may not be altered via attribute((optimize())).