Skip to content

Commit 17f6ac0

Browse files
committed
fix #57749, model ccall binding access in inference
1 parent 056e68b commit 17f6ac0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Compiler/src/abstractinterpretation.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,6 +3486,16 @@ function refine_partial_type(@nospecialize t)
34863486
end
34873487

34883488
function abstract_eval_foreigncall(interp::AbstractInterpreter, e::Expr, sstate::StatementState, sv::AbsIntState)
3489+
callee = e.args[1]
3490+
if isexpr(callee, :call) && length(callee.args) > 1 && callee.args[1] == GlobalRef(Core, :tuple)
3491+
# NOTE these expressions are not properly linearized
3492+
abstract_eval_basic_statement(interp, callee.args[2], sstate, sv)
3493+
if length(callee.args) > 2
3494+
abstract_eval_basic_statement(interp, callee.args[3], sstate, sv)
3495+
end
3496+
else
3497+
abstract_eval_value(interp, callee, sstate, sv)
3498+
end
34893499
mi = frame_instance(sv)
34903500
t = sp_type_rewrap(e.args[2], mi, true)
34913501
for i = 3:length(e.args)

test/ccall.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,3 +1979,11 @@ let llvm = sprint(code_llvm, gc_safe_ccall, ())
19791979
# check for the gc_safe store
19801980
@test occursin("store atomic i8 2", llvm)
19811981
end
1982+
1983+
module Test57749
1984+
using Test, Zstd_jll
1985+
const prefix = "Zstd version: "
1986+
const sym = :ZSTD_versionString
1987+
get_zstd_version() = prefix * unsafe_string(ccall((sym, libzstd), Cstring, ()))
1988+
@test startswith(get_zstd_version(), "Zstd")
1989+
end

0 commit comments

Comments
 (0)