https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119493
Bug ID: 119493 Summary: [12/13/14/15 Regression] missing tail call to self with struct in some cases Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization, tail-call Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Extracted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92474#c1: starting with r273603 (r10-1982-g4eb503965ac70e), the trunk doesn't tail call optimize this either even without -fsanitize=, unless -fno-tree-sra. testcase: ``` struct MyStruct { unsigned n_recurses; }; MyStruct foo(MyStruct m) { return (m.n_recurses == 0)? m : foo(MyStruct{m.n_recurses - 1}); } int main() { foo(MyStruct{999999}); } ```