Quoting one of GCC most important maintainers: "I consider the optimize attribute code seriously broken and unmaintained (but sometimes useful for debugging - and only that)." https://gcc.gnu.org/ml/gcc/2012-07/msg00201.html Unfortunately, the people who added it are either not working on GCC anymore or not interested in fixing it. You can easily find dozens of bug reports in bugzilla where it fails or leads to wrong-code, and this has been the situation since years and not likely to change soon. If it works for you, you are lucky (for now); if it doesn't, you may open a PR in bugzilla in case someone NEW decided to start fixing them, but trying to guess how it is supposed to work by trial-and-error seems futile. The only realistic options are to not use it, to use it and accept its brokenness (current or future one, since it is unmaintained), or join GCC and fix it (perhaps motivating other people along the way to join your effort). Cheers, Manuel. [*] I personally find the interface of the optimize attribute/pragma horrendous from an usability point of view. It would have been better to parse a single string as if it was a command-line, rejecting any invalid options (an attribute in the .opt files could flag which options are valid to appear in the attribute/pragma string). This would have re-used most of the machinery for parsing options while being much more intuitive. Alas, I have little use for this attribute, thus I prefer to spend my time on issues that I care about (I guess this is the same for other GCC devs).