https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104985
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 52696 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52696&action=edit gcc12-pr104985-2.patch A variant patch, also untested, but much smaller. Yet another way would be to change do_SUBST_MODE into SUBST_MODE and just pass the rtx instead of rtx *.