https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534
--- Comment #41 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Lukas Grätz from comment #40) > It seems that the reason for <optimized out> is ultimately -Og, not this > patch. See Bug 78685. No. When PR78685 would be fixed by adding artificial hidden uses of variables at the end of their scopes, this bug would trigger far more often. The vars would be live across the calls, so if there would be callee-saved registers available, the compiler would use them to hold the variables across the calls. And this bug would break that. Anyway, I've posted https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646649.html patch which will not revert the #c15/#c24 changes, but guard them with a non-default option. People who don't care about the harder debugging can use that option in their code, but widely used shared libraries with noreturn entrypoints will no longer screw up the debugging for all the packages that use them.