From 8bd6c04cfc41e9952408fb8bed2db9c7e12a0ee6 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 20 May 2024 20:15:31 +0000 Subject: [PATCH] add codegen test for #93036 --- .../codegen/issues/issue-93036-assert-index.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/codegen/issues/issue-93036-assert-index.rs diff --git a/tests/codegen/issues/issue-93036-assert-index.rs b/tests/codegen/issues/issue-93036-assert-index.rs new file mode 100644 index 00000000000..9e4437cc656 --- /dev/null +++ b/tests/codegen/issues/issue-93036-assert-index.rs @@ -0,0 +1,18 @@ +//@ compile-flags: -O +//@ min-llvm-version: 17 + +#![crate_type = "lib"] + +#[no_mangle] +// CHECK-LABEL: @foo +// CHECK: {{.*}}: +// CHECK: ret +// CHECK-NOT: unreachable +pub fn foo(arr: &mut [u32]) { + for i in 0..arr.len() { + for j in 0..i { + assert!(j < arr.len()); + } + } +} +