https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113506
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>: https://gcc.gnu.org/g:e7108c34a3685eaf9edd3b1fefbd3645b9bd8def commit r15-6398-ge7108c34a3685eaf9edd3b1fefbd3645b9bd8def Author: Alexandre Oliva <ol...@adacore.com> Date: Fri Dec 20 18:01:53 2024 -0300 avoid trying to set block in barriers [PR113506] When we emit a sequence before a preexisting insn and naming a BB to store in the insns, we will attempt to store the BB even in barriers present in the sequence. Barriers don't expect blocks, and rtl checking catches the problem. When emitting after a preexisting insn, we skip the block setting in barriers. Change the before emitter to do so as well. for gcc/ChangeLog PR middle-end/113506 * emit-rtl.cc (add_insn_before): Don't set the block of a barrier. for gcc/testsuite/ChangeLog PR middle-end/113506 * gcc.target/riscv/pr113506.c: New.