[Bug rtl-optimization/87639] GCC fails to consider end of automatic object lifetime when determining sibcall eligibility

bugdal at aerifal dot cx gcc-bugzilla@gcc.gnu.org
Thu Oct 18 11:47:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87639

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> ---
While I'd love to see it fixed via shrink-wrappping, which would fix lots of
other excessive stack usage issues too, like:

if (last_recursion_level) {
    char buf[1000];
    /* code that needs buf */
} else {
    /* code that doesn't need buf */
}

I don't think this is necessary for a fix. It should be possible to update
whatever predicate checks for sibcall eligibility based on having leaked
address of objects on the stack to exclude those whose block lifetime has
ended, without actually going to the trouble of making gcc explicitly free
their stack allocations.


More information about the Gcc-bugs mailing list