diff mbox series

Fix ICE with flatten on uninlinable call

Message ID 20180117204213.GA74553@kam.mff.cuni.cz
State New
Headers show
Series Fix ICE with flatten on uninlinable call | expand

Commit Message

Jan Hubicka Jan. 17, 2018, 8:42 p.m. UTC
Hi,
this patch fixes ICE where we manage to lose the CIF_FINAL failure on inlining.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

	PR ipa/83051
	* ipa-inline.c (flatten_function): Do not overwrite final inlining
	failure.
	* gcc.c-torture/compile/pr83051-2.c: New testcase.
diff mbox series

Patch

Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 256795)
+++ ipa-inline.c	(working copy)
@@ -2083,7 +2083,8 @@  flatten_function (struct cgraph_node *no
 		     "Not inlining %s into %s to avoid cycle.\n",
 		     xstrdup_for_dump (callee->name ()),
 		     xstrdup_for_dump (e->caller->name ()));
-	  e->inline_failed = CIF_RECURSIVE_INLINING;
+	  if (cgraph_inline_failed_type (e->inline_failed) != CIF_FINAL_ERROR)
+	    e->inline_failed = CIF_RECURSIVE_INLINING;
 	  continue;
 	}
 
Index: testsuite/gcc.c-torture/compile/pr83051-2.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr83051-2.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/pr83051-2.c	(working copy)
@@ -0,0 +1,12 @@ 
+/* { dg-options "-fno-early-inlining" } */
+void
+bar ()
+{
+  bar (0);
+}
+
+__attribute__ ((flatten))
+void foo ()
+{
+  bar ();
+}