https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78129
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah - I think a simpler pass would be
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 7256ff9..c1567ca 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -3092,6 +3092,10 @@ do_whole_program_analysis (void)
execute_ipa_pass_list (g->get_passes ()->all_regular_ipa_passes);
+ /* When WPA analysis raises errors, do not bother to output anything. */
+ if (seen_error ())
+ return;
+
if (symtab->dump_file)
{
fprintf (symtab->dump_file, "Optimized ");