Skip to content

Commit 7fa26ce

Browse files
authored
add GenericMemoryRef address space regression test (#59568)
Add test case for LLVM IR generation bug where stores to GenericMemoryRef incorrectly use addrspace(10) instead of addrspace(11) in bounds checking code, causing assertion failures in LLVM optimization passes. This reproduces the issue described in the gist where bounds checking generates incorrect address space casts in the LLVM IR. note : - Tested on CI due to local environment limitations (Termux/Android) issue #59510
2 parents 172125b + 45dd1c6 commit 7fa26ce

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
# RUN: julia --startup-file=no --check-bounds=yes %s %t -O
3+
# RUN: cat %t/* | FileCheck %s
4+
5+
include(joinpath("..", "testhelpers", "llvmpasses.jl"))
6+
7+
# Test for GenericMemoryRef address space bug
8+
# Issue: stores incorrectly use addrspace(10) instead of addrspace(11)
9+
# in bounds checking code, causing LLVM assertion failures
10+
function bf(i, x)
11+
x[i] *= x[i]
12+
nothing
13+
end
14+
15+
# CHECK-LABEL: @julia_bf
16+
# CHECK: oob:
17+
# CHECK: store ptr {{.*}}, ptr %"box::GenericMemoryRef"
18+
# CHECK-NOT: store {{.*}} addrspace(10) {{.*}}GenericMemoryRef
19+
# CHECK: call void @ijl_bounds_error_int
20+
21+
emit(bf, Int, Vector{Float64})

0 commit comments

Comments
 (0)