[Bug tree-optimization/40570] [4.5 Regression] ICE with recursion at -O3
jamborm at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 29 13:41:00 GMT 2009
------- Comment #11 from jamborm at gcc dot gnu dot org 2009-07-29 13:40 -------
(In reply to comment #8)
> That only detects direct loops, does it?
Actually, now I may understand but no, it is exactly the other way
round. The patch above only detects indirect loops, when there are at
least two nodes involved. But that is not necessarily true, as I have
just discovered the hard way when testing my ipa-cp stuff... The
updated patch which I am going to test now therefore is:
2009-07-30 Martin Jambor <mjambor@suse.cz>
* ipa-inline.c (cgraph_decide_inlining): Watch out for dead single
use inlining loops.
* testsuite/gcc.c-torture/compile/pr40570.c: New test.
Index: icln/gcc/ipa-inline.c
===================================================================
--- icln.orig/gcc/ipa-inline.c
+++ icln/gcc/ipa-inline.c
@@ -1227,6 +1227,8 @@ cgraph_decide_inlining (void)
&& !node->needed
&& node->local.inlinable
&& node->callers->inline_failed
+ && node->callers->caller != node
+ && node->callers->caller->global.inlined_to != node
&& !gimple_call_cannot_inline_p (node->callers->call_stmt)
&& !DECL_EXTERNAL (node->decl)
&& !DECL_COMDAT (node->decl))
Index: icln/gcc/testsuite/gcc.c-torture/compile/pr40570.c
===================================================================
--- /dev/null
+++ icln/gcc/testsuite/gcc.c-torture/compile/pr40570.c
@@ -0,0 +1,19 @@
+static int foo(int i);
+
+static int bar(int i) { foo(i); }
+
+static int foo(int i)
+{
+ int j;
+ if (j)
+ FOO(j);
+ return bar(i);
+}
+
+int baz()
+{
+ foo(0);
+ if (baz())
+ return 1;
+ return 0;
+}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40570
More information about the Gcc-bugs
mailing list