diff mbox

Fix -fdump-ipa-all ICE

Message ID 20170424104819.GB15800@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka April 24, 2017, 10:48 a.m. UTC
Hi,
this patch fixes ICE in dumping that triggers somewhat overactive sanity check.
I think it would be nice to get it into release branches so we could debug things
more easily.

I am going to commit to trunk, OK for release branches?
Honza
	PR middle-end/79931
	* ipa-devirt.c (dump_possible_polymorphic_call_targets): Fix ICE.

Comments

Jakub Jelinek April 24, 2017, 10:51 a.m. UTC | #1
On Mon, Apr 24, 2017 at 12:48:19PM +0200, Jan Hubicka wrote:
> Hi,
> this patch fixes ICE in dumping that triggers somewhat overactive sanity check.
> I think it would be nice to get it into release branches so we could debug things
> more easily.
> 
> I am going to commit to trunk, OK for release branches?
> Honza
> 	PR middle-end/79931
> 	* ipa-devirt.c (dump_possible_polymorphic_call_targets): Fix ICE.

No testcase in the patch?

> Index: ipa-devirt.c
> ===================================================================
> --- ipa-devirt.c	(revision 246970)
> +++ ipa-devirt.c	(working copy)
> @@ -3367,7 +3367,13 @@ dump_possible_polymorphic_call_targets (
>        fprintf (f, "  Speculative targets:");
>        dump_targets (f, targets);
>      }
> -  gcc_assert (targets.length () <= len);
> +  /* Ugly: during callgraph construction the target cache may get populated
> +     before all targets are found.  While this is harmless (because all local
> +     types are discovered and only in those case we devirtualize fully and we
> +     don't do speculative devirtualization before IPA stage) it triggers
> +     assert here when dumping at that stage also populates the case with
> +     speculative targets.  Quietly ignore this.  */
> +  gcc_assert (symtab->state < IPA_SSA || targets.length () <= len);
>    fprintf (f, "\n");
>  }
>  

	Jakub
diff mbox

Patch

Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c	(revision 246970)
+++ ipa-devirt.c	(working copy)
@@ -3367,7 +3367,13 @@  dump_possible_polymorphic_call_targets (
       fprintf (f, "  Speculative targets:");
       dump_targets (f, targets);
     }
-  gcc_assert (targets.length () <= len);
+  /* Ugly: during callgraph construction the target cache may get populated
+     before all targets are found.  While this is harmless (because all local
+     types are discovered and only in those case we devirtualize fully and we
+     don't do speculative devirtualization before IPA stage) it triggers
+     assert here when dumping at that stage also populates the case with
+     speculative targets.  Quietly ignore this.  */
+  gcc_assert (symtab->state < IPA_SSA || targets.length () <= len);
   fprintf (f, "\n");
 }