This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix PR81360
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 19 Nov 2017 21:06:19 +0100
- Subject: Fix PR81360
- Authentication-results: sourceware.org; auth=none
Hi,
this testcase triggers ICE because we try to inline into -O0 function.
Fixed thus.
Bootstrapped/regtested x86_64-linux, comitted.
Honza
* gcc.c-torture/compile/pr81360.c: New testcase.
* ipa-inline.c (can_inline_edge_p): Also check that caller is optimized
Index: testsuite/gcc.c-torture/compile/pr81360.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr81360.c (revision 0)
+++ testsuite/gcc.c-torture/compile/pr81360.c (working copy)
@@ -0,0 +1,11 @@
+typedef a;
+b(void *c, a d) {
+ if (c)
+ e(0, __PRETTY_FUNCTION__);
+}
+typedef f, g;
+__attribute__((optimize(0))) h() {
+ g i;
+ b(i, sizeof(f));
+}
+
Index: ipa-inline.c
===================================================================
--- ipa-inline.c (revision 254929)
+++ ipa-inline.c (working copy)
@@ -324,7 +324,8 @@ can_inline_edge_p (struct cgraph_edge *e
e->inline_failed = CIF_BODY_NOT_AVAILABLE;
inlinable = false;
}
- if (!early && !opt_for_fn (callee->decl, optimize))
+ if (!early && (!opt_for_fn (callee->decl, optimize)
+ || opt_for_fn (caller->decl, optimize)))
{
e->inline_failed = CIF_FUNCTION_NOT_OPTIMIZED;
inlinable = false;