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

--- Comment #8 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Looking at `can_inline_edge_p()` I noticed that generally `gcc` disallows
inlining callee's that call `comdat_local`:

  static bool
  can_inline_edge_p (struct cgraph_edge *e, bool report, bool early = false)
  {
  // ...
    else if (callee->calls_comdat_local)
    {
      e->inline_failed = CIF_USES_COMDAT_LOCAL;
      inlinable = false;
  // ...

But in this case we effectively inadvertently do such an inlining as comdat
call becomes visible only after the inline.

I have a few calligraphy questions for Jan and Matrin:

1. Do I understand correctly that the rejection of `calls_comdat_local` inline
is a correctness requirement to avoid different definitions of a comdat symbol
in different translation units?

2. Given the above: should ipa-inline try to attempt to inline `emit()` into
`S::sm()`, or is it a violation of [2.]?

If the inline is forbidden it feels like `ipa-inline` should prevent inlining
of function with indirect unknown edges into the symbols with combat groups
like that.

Reply via email to