https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64052
--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- (In reply to Eugene from comment #4) > I am not arguing for the sample code to be compilable and functional. > My expectation is a consistent compilation result regardless of the > optimisation settings. If it fails with 'O0' should fail with 'Os' too. IMO this "consistency" is not feasible as the result depends on the optimization level and probably optimization switches. For such a "consistency" the compiler would have to know the results of all other possible option sets. Not all diagnostics are emit during lexing or parsing, many diagnostics depend on further analysis of code and data and might run after early inlining or dead code / data elimination.