https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119523
Bug ID: 119523 Summary: missing tail call with aggregate returns wrappers with extraction inbetween Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: missed-optimization, tail-call Severity: enhancement Priority: P3 Component: tree-optimization Assignee: pinskia at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` typedef struct wrapper{int i;} wrapper; wrapper f(); wrapper g() { int t = f().i; return (wrapper){t}; } wrapper g1() { return f(); } ``` GCC is able to sibcall f inside g1 (since r7-4743-g9713daa015b807) but not inside g. The IR for PR 119493 shows the same issue here after SRA. Though the fix for PR 119493 is to support aggregate arguments for tail recursion; it will still be a good idea to fix this as it might show up with other code. Working on a fix.