https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106594 --- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is just missed optimization and likely to be resolved only for GCC 14 and perhaps later backported. Downgrading to P2.