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

--- Comment #43 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/testsuite/g++.dg/lto/pr119614-1_0.C.jj  2025-04-16 10:37:44.584969998
+0200
+++ gcc/testsuite/g++.dg/lto/pr119614-1_0.C     2025-04-16 10:51:29.805679013
+0200
@@ -0,0 +1,41 @@
+// PR tree-optimization/119614
+// { dg-lto-do link }
+// { dg-lto-options { { -O2 -fPIC -flto -flto-partition=max } } }
+// { dg-require-effective-target shared }
+// { dg-require-effective-target fpic }
+// { dg-require-effective-target musttail }
+// { dg-extra-ld-options "-shared" }
+
+struct S {} b;
+char *foo ();
+int e, g;
+void bar (int, int);
+void corge (S);
+struct T { int a, b; };
+
+[[gnu::noinline]] static char *
+baz (int x, T y)
+{
+  bar (x, y.b);
+  return 0;
+}
+
+const char *
+qux (int, T)
+{
+  if (e)
+    {
+      S a = b;
+      corge (a);
+      if (g)
+        return 0;
+      [[gnu::musttail]] return baz (42, T { 1, 2 });
+    }
+  return foo ();
+}
+
+const char *
+freddy ()
+{
+  return baz (42, T { 3, 4 });
+}

seems to work though, even when it clones the function.

Reply via email to