Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix abstract_eval_cfunction mistakes #56856

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Compiler/src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2894,20 +2894,21 @@ end

function abstract_eval_cfunction(interp::AbstractInterpreter, e::Expr, sstate::StatementState, sv::AbsIntState)
f = abstract_eval_value(interp, e.args[2], sstate, sv)
# rt = sp_type_rewrap(e.args[3], sv.linfo, true)
# rt = sp_type_rewrap(e.args[3], sv.linfo, true) # verify that the result type make sense?
# rt === Bottom && return RTEffects(Union{}, Any, EFFECTS_UNKNOWN)
atv = e.args[4]::SimpleVector
at = Vector{Any}(undef, length(atv) + 1)
at[1] = f
for i = 1:length(atv)
at[i + 1] = sp_type_rewrap(at[i], frame_instance(sv), false)
at[i + 1] === Bottom && return
atᵢ = at[i + 1] = sp_type_rewrap(atv[i], frame_instance(sv), false)
atᵢ === Bottom && return RTEffects(Union{}, Any, EFFECTS_UNKNOWN)
end
# this may be the wrong world for the call,
# but some of the result is likely to be valid anyways
# and that may help generate better codegen
abstract_call(interp, ArgInfo(nothing, at), StmtInfo(false, false), sv)::Future
rt = e.args[1]
isa(rt, Type) || (rt = Any)
isconcretetype(rt) || (rt = Any)
return RTEffects(rt, Any, EFFECTS_UNKNOWN)
end

Expand Down
Loading