https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63851

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
OK, I can reproduce the problem on x86_64 with following simple patch applied:

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 4875dec..c985052 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -606,6 +606,12 @@ sem_function::merge (sem_item *alias_item)
       create_thunk = true;
     }

+  if (create_alias )
+  {
+    create_thunk = true;
+    create_alias = false;
+  }
+


There's a pair of functions 'g' and 'h' that are proved by IPA ICF to be equal
and thunk is created (darwin does not have alias support).
Semantic equality hit:g->h
Assembler symbol names:g.3324->h.3321

where 'h' looks is created as tail-call:

h (struct array7_integer(kind=4) & restrict x)
{
  <bb 2>:
  g (x_2(D)); [tail call]
  return;

}

and MAIN__:
  <bb 8>:
  # kk_1 = PHI <kk_36(6), kk_39(7)>
  *kk_1 = 489;
  desc.6.dtype = 264;
  desc.6.data = kk_1;
  h (&desc.6); [static-chain: &FRAME.15]
  desc.6 ={v} {CLOBBER};
  j.8_45 = FRAME.15.j;
  if (j.8_45 != 1)
    goto <bb 9>;
  else
    goto <bb 10>;


It looks fine, but after inlining is done, we are given:

assumed_rank_8.f90.063t.copyrename2:

MAIN__:
...
  <bb 24>:
  # kk_11 = PHI <kk_9(22), kk_10(23)>
  *kk_11 = 489;
  desc.6.dtype = 264;
  desc.6.data = kk_11;
  g (&desc.6);
  desc.6 ={v} {CLOBBER};
  j.8_12 = FRAME.15.j;
  if (j.8_12 != 1)
    goto <bb 25>;
  else
    goto <bb 26>;

Is missing [static-chain: &FRAME.15] in 'g (&desc.6);' problematic in this
context?

Thanks,
Martin

Reply via email to