Skip to content

Commit aecb173

Browse files
authored
Fix assume effects handling for gc_safe (#59557)
Fixes #59552
1 parent 0991d10 commit aecb173

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

base/c.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,6 @@ macro ccall(exprs...)
458458
return ccall_macro_lower((:ccall), ccall_macro_parse(exprs)...)
459459
end
460460

461-
macro ccall_effects(effects::UInt16, expr)
462-
return ccall_macro_lower((:ccall, effects), ccall_macro_parse(expr)...)
461+
macro ccall_effects(effects::UInt16, exprs...)
462+
return ccall_macro_lower((:ccall, effects), ccall_macro_parse(exprs)...)
463463
end

test/ccall.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,14 +1970,15 @@ end
19701970

19711971
function gc_safe_ccall()
19721972
# jl_rand is marked as JL_NOTSAFEPOINT
1973-
@ccall gc_safe=true jl_rand()::UInt64
1973+
Base.@assume_effects :nothrow @ccall gc_safe=true jl_rand()::UInt64
19741974
end
19751975

19761976
let llvm = sprint(code_llvm, gc_safe_ccall, ())
19771977
# check that the call works
19781978
@test gc_safe_ccall() isa UInt64
19791979
# check for the gc_safe store
19801980
@test occursin("store atomic i8 2", llvm)
1981+
@test Base.infer_effects(gc_safe_ccall, Tuple{}).nothrow == true
19811982
end
19821983

19831984
@testset "jl_dlfind and dlsym" begin

0 commit comments

Comments
 (0)