https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
--- Comment #28 from Linus Torvalds <torva...@linux-foundation.org> --- (In reply to Roger Sayle from comment #27) > This should now be fixed on both mainline and the GCC 12 release branch. Thanks everybody. Looks like the xchg optimization isn't in the gcc-12 release branch, but the stack use looks reasonable from my (very limited) testing.