https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70678
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Declaring test_function inline and using -Winline shows: t.c:4:52: warning: inlining failed in call to ‘test_function’: optimization level attribute mismatch [-Winline] static inline void __attribute__((optimize("O2"))) test_function() { ^~~~~~~~~~~~~ which is because while -fwrapv is still set -fno-strict-aliasing is not. This is because parse_optimize_options (-O2) will turn on -fstrict-aliasing. It does that via calling 301 default_options_optimization (opts, opts_set, 302 decoded_options, decoded_options_count, 303 loc, lang_mask, &handlers, dc); and I think this is intended behavior. It's a little inconsistent that -fwrapv is not changed, but that's because it is never on by default.