GCC bug 58416 has been fixed, and the fix should appear in in the forthcoming GCC 15. I installed the attached patch into GNU Emacs, so that Emacs no longer attempts to work around the bug if GCC 15+ is being used.