https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111312
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I think the analyzer runs at the "correct" place as a regular IPA pass which makes it possible for it to see the whole program (with -flto). As with any of our late diagnostic passes there's trade-off when optimizing less or more. It should be possible to use -fanalyzer -flto -O0, correct? The main question to me is whether -fanalyzer is supposed to be a static analyzer only operation, thus the produced object files are really an unwanted artifact. If not, and -fanalyzer should be useful for full release builds then I think -fanalyzer vs. -fno-analyzer shouldn't have any effect on code generation (much like diagnostic options), but then one might argue splitting analyzer into two phases, one early, for example after SSA rewrite where most early diagnostic passes reside, and one late, where it currently resides, would be appropriate to divert analyses prone to false positives/negatives when run on optimized code early. But then duplicate diagnostics would have to be suppressed somehow (or the result processed by tooling which could even correlate early/late findings).