https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119311
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Summary|musttail attribute |musttail attribute is lost
|ineffective at -O0 and -O1 |sometimes as single
| |statement for then part of
| |an if statement
Last reconfirmed| |2025-03-16
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like the C front-end loses the musttail call attribute.
Workaround is to do:
if (a > b) {
[[gnu::musttail]] return gcd (a , b);
}
else {
[[gnu::musttail]]return gcd (a, b);
}