Skip to content

AliasTable([0.5, 0.7]) hangs the REPL on 32bit Julia v1.12.0-beta4 #62

@npbarnes

Description

@npbarnes

To reproduce: install 32bit Julia v1.12.0-beta4 (e.g. juliaup add 1.12.0-beta4~x86) start it (julia +1.12.0-beta4~x86) and run the following commands.

(@v1.12) pkg> activate --temp
  Activating new project at `/tmp/jl_3F6MQm`

(jl_3F6MQm) pkg> add AliasTables
   Resolving package versions...
    Updating `/tmp/jl_3F6MQm/Project.toml`
  [66dad0bd] + AliasTables v1.1.3
    Updating `/tmp/jl_3F6MQm/Manifest.toml`
  [66dad0bd] + AliasTables v1.1.3
  [43287f4e] + PtrArrays v1.3.0
  [9a3f8284] + Random v1.11.0
  [ea8e919c] + SHA v0.7.0

julia> using AliasTables

julia> AliasTable([0.3, 0.7])
JIT session error: Symbols not found: [ __udivti3 ]
JIT session error: Failed to materialize symbols: { (JuliaOJIT, { julia_normalize_to_uint!_1153 }) }
JIT session error: Failed to materialize symbols: { (JuliaOJIT, { julia_#set_weights!#5_1071 }) }

Then it just freezes there. Sometimes the latter two errors don't appear.

The specific values of 0.5 and 0.7 don't matter. But they do seem to need to be floats. For example:

julia> using AliasTables

julia> AliasTable([1, 2])
AliasTable([0x5555555555555556, 0xaaaaaaaaaaaaaaaa])

julia> AliasTable([1.0, 2.0])
JIT session error: Symbols not found: [ __udivti3 ]

If you run it in the debugger it works fine.

julia> using AliasTables, Debugger

julia> @enter AliasTable([1.0,2.0])
In #AliasTable#3(_normalize, , weights) at /home/deck/.julia/packages/AliasTables/N6kwW/src/AliasTables.jl:69
>69  AliasTable(weights::AbstractVector{<:Real}; _normalize=true) = AliasTable{UInt64, Int}(weights; _normalize=_normalize)

About to run: apply_type(AliasTable, UInt64, Int32)
1|debug> c
AliasTable([0x5555555555555556, 0xaaaaaaaaaaaaaaaa])

But, not if you try to inspect what's happening

julia> @enter AliasTable([1.0,2.0])
In #AliasTable#3(_normalize, , weights) at /home/deck/.julia/packages/AliasTables/N6kwW/src/AliasTables.jl:69
>69  AliasTable(weights::AbstractVector{<:Real}; _normalize=true) = AliasTable{UInt64, Int}(weights; _normalize=_normalize)

About to run: apply_type(AliasTable, UInt64, Int32)
1|debug> s
ERROR: BoundsError: attempt to access 11-element Vector{Any} at index [12]
Stacktrace:
 [1] AliasTable(weights::Vector{Float64}; _normalize::Bool)
   @ AliasTables ~/.julia/packages/AliasTables/N6kwW/src/AliasTables.jl:69
 [2] AliasTable(weights::Vector{Float64})
   @ AliasTables ~/.julia/packages/AliasTables/N6kwW/src/AliasTables.jl:69

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstream

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions