https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115929
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:43a7ece873eba47a11c0b21b0068eee53740551a commit r15-2111-g43a7ece873eba47a11c0b21b0068eee53740551a Author: Richard Sandiford <richard.sandif...@arm.com> Date: Wed Jul 17 19:38:12 2024 +0100 rtl-ssa: Fix move range canonicalisation [PR115929] In this PR, canonicalize_move_range walked off the end of a list and triggered a null dereference. There are multiple ways of fixing that, but I think the approach taken in the patch should be relatively efficient. gcc/ PR rtl-optimization/115929 * rtl-ssa/movement.h (canonicalize_move_range): Check for null prev and next insns and create an invalid move range for them. gcc/testsuite/ PR rtl-optimization/115929 * gcc.dg/torture/pr115929-2.c: New test.