https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116065
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- "Reduced": #ifndef __AVX__ #pragma GCC push_options #pragma GCC target("avx") #define __DISABLE_AVX__ #endif /* __AVX__ */ extern inline double __attribute__((__gnu_inline__,__always_inline__)) foo (double x) { return x; } #ifdef __DISABLE_AVX__ #undef __DISABLE_AVX__ #pragma GCC pop_options #endif /* __DISABLE_AVX__ */ void __attribute__((target ("avx"), optimize(3))) bar (double *p) { *p = foo (*p); } works with -mavx _or_ with -O[23], fails without. Fails(!?) with -O1 as well. So it's somehow the interaction between optimize and target. Somebody needs to sit down and trace differences between -O2 and -O1 for example.