]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix crash on break outside of loop context
authorPhilip Herron <herron.philip@googlemail.com>
Sun, 31 Aug 2025 22:20:03 +0000 (23:20 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 19:59:08 +0000 (20:59 +0100)
commitef0d55f4a8f37941a51fad68970492f11b442d56
treed9e7a6f24406af07e7bc1409bb14a321a39db72e
parent1422fa61b44963f0b3ed19e110bd7ccbddd311ce
gccrs: Fix crash on break outside of loop context

We need to add a guard to catch the case when there is no loop context
for break outside of loop.

Fixes Rust-GCC#3969

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): add guard

gcc/testsuite/ChangeLog:

* rust/compile/issue-3969.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/backend/rust-compile-expr.cc
gcc/testsuite/rust/compile/issue-3969.rs [new file with mode: 0644]