* [PATCH] Fix hang in inline_small_functions (PR ipa/84425)
@ 2018-02-16 22:49 Jakub Jelinek
2018-02-16 23:03 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-02-16 22:49 UTC (permalink / raw)
To: Jan Hubicka, Richard Biener; +Cc: gcc-patches
Hi!
When debugging a wrong-code in miniruby on aarch64, I've noticed a hang
in inline_small_functions when adding __attribute__((optimize(0)))
to one of the functions.
I don't know what exactly the code is doing, but it feels like a typo for
me, at least I'd expect the intent is for n2 to walk the whole chain,
rather than just the first 2 elements of it and then hope something changes
the ((struct ipa_dfs_info *) node->aux)->next_cycle to something different,
when the loop body is
if (opt_for_fn (n2->decl, optimize))
{
struct ipa_fn_summary *info2 = ipa_fn_summaries->get (n2);
if (info2->scc_no)
break;
info2->scc_no = id;
}
and so for some n2's isn't doing anything and at least the method name get
doesn't suggest it would update something.
While the regression on this testcase is recent, I think the bug is latent
since 2012 when this code has been introduced.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2018-02-16 Jakub Jelinek <jakub@redhat.com>
PR ipa/84425
* ipa-inline.c (inline_small_functions): Fix a typo.
* gcc.c-torture/compile/pr84425.c: New test.
--- gcc/ipa-inline.c.jj 2018-01-30 16:57:25.265095696 +0100
+++ gcc/ipa-inline.c 2018-02-16 20:53:54.803512238 +0100
@@ -1782,7 +1782,7 @@ inline_small_functions (void)
struct cgraph_node *n2;
int id = dfs->scc_no + 1;
for (n2 = node; n2;
- n2 = ((struct ipa_dfs_info *) node->aux)->next_cycle)
+ n2 = ((struct ipa_dfs_info *) n2->aux)->next_cycle)
if (opt_for_fn (n2->decl, optimize))
{
struct ipa_fn_summary *info2 = ipa_fn_summaries->get (n2);
--- gcc/testsuite/gcc.c-torture/compile/pr84425.c.jj 2018-02-16 20:54:46.785534252 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr84425.c 2018-02-16 20:55:00.628540119 +0100
@@ -0,0 +1,17 @@
+/* PR ipa/84425 */
+
+void bar (int);
+
+void
+foo (int x)
+{
+ if (x < 5)
+ bar (x);
+}
+
+__attribute__((optimize(0))) void
+bar (int x)
+{
+ if (x > 10)
+ foo (x);
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix hang in inline_small_functions (PR ipa/84425)
2018-02-16 22:49 [PATCH] Fix hang in inline_small_functions (PR ipa/84425) Jakub Jelinek
@ 2018-02-16 23:03 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-02-16 23:03 UTC (permalink / raw)
To: Jakub Jelinek, Jan Hubicka, Richard Biener; +Cc: gcc-patches
On 02/16/2018 03:49 PM, Jakub Jelinek wrote:
> Hi!
>
> When debugging a wrong-code in miniruby on aarch64, I've noticed a hang
> in inline_small_functions when adding __attribute__((optimize(0)))
> to one of the functions.
>
> I don't know what exactly the code is doing, but it feels like a typo for
> me, at least I'd expect the intent is for n2 to walk the whole chain,
> rather than just the first 2 elements of it and then hope something changes
> the ((struct ipa_dfs_info *) node->aux)->next_cycle to something different,
> when the loop body is
> if (opt_for_fn (n2->decl, optimize))
> {
> struct ipa_fn_summary *info2 = ipa_fn_summaries->get (n2);
> if (info2->scc_no)
> break;
> info2->scc_no = id;
> }
> and so for some n2's isn't doing anything and at least the method name get
> doesn't suggest it would update something.
> While the regression on this testcase is recent, I think the bug is latent
> since 2012 when this code has been introduced.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-02-16 Jakub Jelinek <jakub@redhat.com>
>
> PR ipa/84425
> * ipa-inline.c (inline_small_functions): Fix a typo.
>
> * gcc.c-torture/compile/pr84425.c: New test.
Looks like a typo to me too.
OK.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-16 23:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16 22:49 [PATCH] Fix hang in inline_small_functions (PR ipa/84425) Jakub Jelinek
2018-02-16 23:03 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).