https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107078
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Then as documented, -fno-lifetime-dse or -flifetime-dse=1 can be a temporary workaround, but as has been said, such code is undefined behavior and should be fixed in the application. See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flifetime-dse