]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE in -fdiagnostics-generate-patch [PR112684]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 9 May 2024 17:09:32 +0000 (13:09 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 9 May 2024 17:09:32 +0000 (13:09 -0400)
Backported from r14-8255-ge254d1224df306.

gcc/ChangeLog:
PR middle-end/112684
* toplev.cc (toplev::main): Don't ICE in
-fdiagnostics-generate-patch when exiting after options,
since no edit context will have been created.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/toplev.cc

index 109c9d58cbd1950b49c78a21166a916a919162da..19391208eac27c82a363144cf1b3194b71cfcd13 100644 (file)
@@ -2292,10 +2292,8 @@ toplev::main (int argc, char **argv)
      emit some diagnostics here.  */
   invoke_plugin_callbacks (PLUGIN_FINISH, NULL);
 
-  if (flag_diagnostics_generate_patch)
+  if (global_dc->edit_context_ptr)
     {
-      gcc_assert (global_dc->edit_context_ptr);
-
       pretty_printer pp;
       pp_show_color (&pp) = pp_show_color (global_dc->printer);
       global_dc->edit_context_ptr->print_diff (&pp, true);