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

gotoing to inside of a gc_preserve crashes julia #55905

Open
gbaraldi opened this issue Sep 27, 2024 · 1 comment
Open

gotoing to inside of a gc_preserve crashes julia #55905

gbaraldi opened this issue Sep 27, 2024 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@gbaraldi
Copy link
Member

function foo()
              x = Ref{Int}(101)
              p = Base.unsafe_convert(Ptr{Int}, x)
              @goto foo2
              GC.@preserve x begin
              @label foo2
              unsafe_load(p)
              end
              end

foo()
Internal error: during type inference of
foo()
Encountered unexpected error in runtime:
MethodError(f=Base.inferencebarrier, args=(typeof(Core.Compiler._assert_tostring)(),), world=0x00000000000017b6)
jl_method_error_bare at /Users/gabrielbaraldi/julia2/src/gf.c:2349
jl_method_error at /Users/gabrielbaraldi/julia2/src/gf.c:2367
jl_lookup_generic_ at /Users/gabrielbaraldi/julia2/src/gf.c:3344 [inlined]
ijl_apply_generic at /Users/gabrielbaraldi/julia2/src/gf.c:3359
renumber_ssa at ./compiler/ssair/slot2ssa.jl:56
#renumber_ssa!##0 at ./compiler/ssair/slot2ssa.jl:62 [inlined]
ssamap at ./compiler/utilities.jl:392
renumber_ssa! at ./compiler/ssair/slot2ssa.jl:62 [inlined]
domsort_ssa! at ./compiler/ssair/slot2ssa.jl:460
construct_ssa! at ./compiler/ssair/slot2ssa.jl:879
slot2reg at ./compiler/optimize.jl:1280 [inlined]
run_passes_ipo_safe at ./compiler/optimize.jl:986
run_passes_ipo_safe at ./compiler/optimize.jl:1001 [inlined]
optimize at ./compiler/optimize.jl:975
jfptr_optimize_34044 at /Users/gabrielbaraldi/julia2/usr/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/gabrielbaraldi/julia2/src/gf.c:3167
finish_nocycle at ./compiler/typeinfer.jl:278
_typeinf at ./compiler/typeinfer.jl:266
typeinf at ./compiler/typeinfer.jl:207
typeinf_ext at ./compiler/typeinfer.jl:1184
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1255 [inlined]
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1253
jfptr_typeinf_ext_toplevel_31411 at /Users/gabrielbaraldi/julia2/usr/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/gabrielbaraldi/julia2/src/gf.c:3167
jl_apply at /Users/gabrielbaraldi/julia2/src/julia.h:2220 [inlined]
jl_type_infer at /Users/gabrielbaraldi/julia2/src/gf.c:394
jl_compile_method_internal at /Users/gabrielbaraldi/julia2/src/gf.c:2733
_jl_invoke at /Users/gabrielbaraldi/julia2/src/gf.c:3178
@oscardssmith oscardssmith added bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Sep 27, 2024
@topolarity
Copy link
Member

Our definition of gc_preserve_begin strongly suggests there should be a single syntactic entry to the block, so I guess the bug here is that we don't enforce that in lowering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

3 participants