https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115447
Bug ID: 115447 Summary: GCC fails to tail call unless variable wrapped in a block Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: mikolajpirog at gmail dot com Target Milestone: --- GCC 14.1 fails to perform a tail call optimization when a function has a variable with a non-trivial dtor, unless the variable is put inside a block statement. Putting the variable inside this block does not change the semantics of the function, but makes the dtor fire up before calling the next function, so TCO may be performed. Compiler explorer: https://godbolt.org/z/r6TvsG3W4