From d15a092d88dd817800a183dc43312a968eb436e0 Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Tue, 8 Oct 2024 22:35:09 -0400 Subject: [PATCH] effects: fix `Base.@_noub_meta` This had the incorrect number of arguments to `Expr(:purity, ...)` causing it to be silently ignored. --- base/essentials.jl | 3 ++- src/method.c | 2 ++ test/compiler/effects.jl | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/base/essentials.jl b/base/essentials.jl index 32c44a9571f23..0e7be924c908c 100644 --- a/base/essentials.jl +++ b/base/essentials.jl @@ -337,7 +337,8 @@ macro _noub_meta() #=:inaccessiblememonly=#false, #=:noub=#true, #=:noub_if_noinbounds=#false, - #=:consistent_overlay=#false)) + #=:consistent_overlay=#false, + #=:nortcall=#false)) end # can be used in place of `@assume_effects :notaskstate` (supposed to be used for bootstrapping) macro _notaskstate_meta() diff --git a/src/method.c b/src/method.c index 6aba60e7fe12c..629816319b334 100644 --- a/src/method.c +++ b/src/method.c @@ -491,6 +491,8 @@ jl_code_info_t *jl_new_code_info_from_ir(jl_expr_t *ir) if (consistent_overlay) li->purity.overrides.ipo_consistent_overlay = consistent_overlay; int8_t nortcall = jl_unbox_bool(jl_exprarg(ma, 10)); if (nortcall) li->purity.overrides.ipo_nortcall = nortcall; + } else { + assert(jl_expr_nargs(ma) == 0); } } else diff --git a/test/compiler/effects.jl b/test/compiler/effects.jl index 8bc5f27e31766..c8a699b294d37 100644 --- a/test/compiler/effects.jl +++ b/test/compiler/effects.jl @@ -810,7 +810,12 @@ end # @test !Core.Compiler.is_nothrow(effects) # end #end -# + +@test Core.Compiler.is_noub(Base.infer_effects(Base._growbeg!, (Vector{Int}, Int))) +@test Core.Compiler.is_noub(Base.infer_effects(Base._growbeg!, (Vector{Any}, Int))) +@test Core.Compiler.is_noub(Base.infer_effects(Base._growend!, (Vector{Int}, Int))) +@test Core.Compiler.is_noub(Base.infer_effects(Base._growend!, (Vector{Any}, Int))) + # tuple indexing # --------------