https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123380
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:1bede52d8c4ba434a8f4786f84f85922cc0c6152 commit r16-6940-g1bede52d8c4ba434a8f4786f84f85922cc0c6152 Author: Jeff Law <[email protected]> Date: Tue Jan 20 15:03:28 2026 -0700 [PR rtl-optimization/123380] Avoid creating bogus SUBREG in combine In this issue we try to call gen_rtx_SUBREG with arguments that will trigger an assertion failure. In particular we're trying to create a paradoxical subreg of an HFmode object where the paradoxical is in DImode. That's obviously a change in size. validate_subreg returns false for that case, thus triggering the assertion. Like other cases in combine.cc and elsewhere we can check validate_subreg before we call gen_rtx_SUBREG and if validate_subreg returns false, we can return a safe value. So that's all this patch does. Bootstrapped and regression tested on x86_64, also regression tested on riscv{32,64}-elf. Pushing to the trunk. PR rtl-optimization/123380 gcc/ * combine.cc (gen_lowpart_for_combine): Don't try to create a paradoxical SUBREG if it's going to be rejected by validate_subreg. gcc/testsuite/ * gcc.target/riscv/pr123380.c: New test.
