https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106274
--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > I'm not sure to what extent this is still required with respect to the > diagnostic context though - you'd have to try. Thanks for the explanation, the general nature of it makes sense to me now. There is one current testcase (g++.dg/20090121-1.C) which demonstrates that it's not OK to simply skip calling tree_diagnostics_defaults () entirely for -flto... For that testcase, the -Wuninitialized diagnostic calling back into the C+ frontend (cp_printer) would ICE after ipa-free-lang-data pass if so. It seems like it should be doable to address this, maybe frontends could specify how they want ipa-free-lang-data to adjust their diagnostic context, so it wouldn't have to be all or nothing. I can look into that sometime, perhaps it would help with enabling this pass to run during non-LTO compilation as well.