https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82107
--- Comment #1 from loquens at yandex dot ru --- Additional research found, that error produced by -O1 and -finline-small-functions -fipa-icf -foptimize-sibling-calls. All three flags must be present to get an error. If you exclude -foptimize-sibling-calls, you'll get an stack overflow.