Hello All I'm re-reading toplev_main from gcc/toplev.c and I find strange that invoke_plugin_callbacks for PLUGIN_FINISH was called before diagnostic_finish (which I guess is finalizing all the diagnostic infrastructure).
My guess would be that some GCC plugins might occasionally emit a diagnostic at PLUGIN_FINISH stage. Imagine a plugin which fills some database (e.g. with software metrics). It would probably close the database at PLUGIN_FINISH, and in the rare event that database closing fails, emit a diagnostic (using e.g. error) ######## proposed patch against trunk svn rev 203073 Index: gcc/toplev.c =================================================================== --- gcc/toplev.c (revision 203073) +++ gcc/toplev.c (working copy) @@ -1970,11 +1970,13 @@ toplev_main (int argc, char **argv) if (warningcount || errorcount || werrorcount) print_ignored_options (); - diagnostic_finish (global_dc); - /* Invoke registered plugin callbacks if any. */ + /* Invoke registered plugin callbacks if any. Some plugins could + emit some diagnostics here. */ invoke_plugin_callbacks (PLUGIN_FINISH, NULL); + diagnostic_finish (global_dc); + finalize_plugins (); location_adhoc_data_fini (line_table); if (seen_error () || werrorcount) ######## proposed gcc/ChangeLog entry 2013-10-01 Basile Starynkevitch <bas...@starynkevitch.net> * toplev.c (toplev_main): Move PLUGIN_FINISH invocation before diagnostic_finish. ##### I am not entirely sure about this patch (because I don't fully understand what diagnostic_finish is supposed to do, just partly guessing it). Comments are welcome. Regards -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***