https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105120
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Keywords| |wrong-code Last reconfirmed| |2022-04-01 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- This is known and hard to fix - it also applies to other macros whose definition depends on optimization flags (like from -ffast-math). When you run into such issue the workaround is to split the translation units at optimization flag boundary. It's odd that we manage to sneak in __OPTIMIZE__, I didn't know we do. Same applies to -ffast-math it seems: _Pragma("GCC push_options") #ifndef __FAST_MATH__ _Pragma("GCC optimize(\"fast-math\")") #endif inline void noop() {} _Pragma ("GCC pop_options") #ifdef __FAST_MATH__ #pragma message("__FAST_MATH__ defined") #endif so pop_options fails to pop the macro definitions.