https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128829
Bug ID: 128829
Summary: Tail-call failure due to IPA-induced return type
mismatch
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: tonalan at ebay dot com
Target Milestone: ---
When a split has no return value or does not return, the outlined
function becomes `void`-returning. However, if the enclosing function
is non-`void` and has a `musttail` call, the call to the outlined split
is also annotated with `musttail`, leading to a return type mismatch.
```
// Compile with `-O3`, GCC >=15.
// Sandbox: <https://godbolt.org/z/bzMxM5Eo6>.
template <int N>
static int f(int *);
[[noreturn]] void fail(int *, int *, int *);
int (*fs[])(int *) = { f<1>, f<2>, f<3> };
template <int N>
static int f(int *p)
{
if (*p < 0)
fail(p, p, p);
[[gnu::musttail]] return fs[*p](p + N);
}
int go(int *p)
{
return f<1>(p);
}
```
I submitted a patch fixing this[^1], but was told to also open a bug
report since the fix might be backported. I was not able to find any
reports demonstrating this exact failure mode among the open
IPA+musttail bugs.
[^1]: https://gcc.gnu.org/pipermail/gcc-patches/2026-November/737370.html