Skip to content

Commit

Permalink
fix #29083, not eliminating kwfunc due to logic error in builtin_nothrow
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 7, 2018
1 parent 5c1d4a3 commit 517044e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ function _builtin_nothrow(@nospecialize(f), argtypes::Array{Any,1}, @nospecializ
length(argtypes) == 1 || return false
return sizeof_nothrow(argtypes[1])
elseif f === Core.kwfunc
length(argtypes) == 2 || return false
length(argtypes) == 1 || return false
return isa(rt, Const)
end
return false
Expand Down
10 changes: 10 additions & 0 deletions test/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ let a = read21311()
@test a[] == 1
end

# issue #29083
f29083(;μ,σ) = μ + σ*randn()
g29083() = f29083=2.0=0.1)
let c = code_typed(g29083, ())[1][1].code
# make sure no call to kwfunc remains
@test !any(e->(isa(e,Expr) && ((e.head === :invoke && e.args[1].def.name === :kwfunc) ||
(e.head === :foreigncall && e.args[1] === QuoteNode(:jl_get_keyword_sorter)))),
c)
end

@testset "issue #19122: [no]inline of short func. def. with return type annotation" begin
exf19122 = @macroexpand(@inline f19122()::Bool = true)
exg19122 = @macroexpand(@noinline g19122()::Bool = true)
Expand Down

0 comments on commit 517044e

Please sign in to comment.