JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.53k stars 5.46k forks source link

Illegal instruction on 1.10.2 but not 1.11+ #53843

Open quinnj opened 6 months ago

quinnj commented 6 months ago

Steps to reproduce with 1.10:

using Pkg
Pkg.activate(;temp=true)
Pkg.add(; url="https://github.com/quinnj/StructUtils.jl", rev="jq-illegal-instruction")
Pkg.test("Structs")

Produces output:

[56114] signal (4): Illegal instruction: 4
in expression starting at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/test/runtests.jl:7
macro expansion at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:382 [inlined]
makestruct at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:369 [inlined]
_make at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:565
MakeClosure at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:525 [inlined]
choosetype at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:133 [inlined]
make at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:534 [inlined]
macro expansion at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:326 [inlined]
KeyValStructClosure at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:300 [inlined]
macro expansion at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:233 [inlined]
applyeach at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:219 [inlined]
macro expansion at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:382 [inlined]
makestruct at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:369 [inlined]
_make at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:565
MakeClosure at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:525 [inlined]
choosetype at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:133 [inlined]
make at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:529 [inlined]
#make#56 at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:512
make at /Users/jacob.quinn/.julia/packages/Structs/9DJD2/src/Structs.jl:512
unknown function (ip: 0x160628053)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3076
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
do_call at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:126
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:0
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:544
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:544
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:544
jl_interpret_toplevel_thunk at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:775
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:934
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:877
ijl_toplevel_eval at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:943 [inlined]
ijl_toplevel_eval_in at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:985
eval at ./boot.jl:385 [inlined]
include_string at ./loading.jl:2076
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3076
_include at ./loading.jl:2136
include at ./client.jl:489
unknown function (ip: 0x1049e8097)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3076
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
do_call at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:126
eval_body at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:0
jl_interpret_toplevel_thunk at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/interpreter.c:775
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:934
jl_toplevel_eval_flex at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:877
ijl_toplevel_eval at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:943 [inlined]
ijl_toplevel_eval_in at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/toplevel.c:985
jlplt_ijl_toplevel_eval_in_25943 at /Users/jacob.quinn/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
eval at ./boot.jl:385 [inlined]
exec_options at ./client.jl:291
_start at ./client.jl:552
jfptr__start_82857 at /Users/jacob.quinn/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/lib/julia/sys.dylib (unknown line)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/gf.c:3076
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
true_main at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/jlapi.c:582
jl_repl_entrypoint at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-HL2F7YQ3XH.0/build/default-honeycrisp-HL2F7YQ3XH-0/julialang/julia-release-1-dot-10/src/jlapi.c:731
Allocations: 4548623 (Pool: 4544507; Big: 4116); GC: 7
ERROR: Package Structs errored during testing (received signal: 4)

The crash does not happen on 1.11 or nightly, so something was fixed along the way, hence I'm mainly opening in case someone can readily see something that needs a backport.

abraemer commented 6 months ago

Runs fine for me on 1.10.2 on AMD.

my `versioninfo` ``` julia> versioninfo() Julia Version 1.10.2 Commit bd47eca2c8a (2024-03-01 10:14 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, znver2) Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores) ```
Julia session ``` _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.10.2 (2024-03-01) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia> Pkg.activate(;temp=true) Activating new project at `/tmp/jl_5EL90p` julia> Pkg.add(url="https://github.com/quinnj/Structs.jl#jq-illegal-instruction") Cloning git-repo `https://github.com/quinnj/Structs.jl#jq-illegal-instruction` Updating git-repo `https://github.com/quinnj/Structs.jl#jq-illegal-instruction` Updating registry at `~/.julia/registries/General.toml` Resolving package versions... Updating `/tmp/jl_5EL90p/Project.toml` [ec057cc2] + Structs v1.0.0 `https://github.com/quinnj/Structs.jl#jq-illegal-instruction#main` Updating `/tmp/jl_5EL90p/Manifest.toml` [ec057cc2] + Structs v1.0.0 `https://github.com/quinnj/Structs.jl#jq-illegal-instruction#main` [ade2ca70] + Dates [de0858da] + Printf [9a3f8284] + Random [ea8e919c] + SHA v0.7.0 [cf7118a7] + UUIDs [4ec0a83e] + Unicode Precompiling project... 1 dependency successfully precompiled in 2 seconds julia> Pkg.test("Structs") Testing Structs Status `/tmp/jl_wKdkBf/Project.toml` [ec057cc2] Structs v1.0.0 `https://github.com/quinnj/Structs.jl#jq-illegal-instruction#main` [ade2ca70] Dates [8dfed614] Test [cf7118a7] UUIDs Status `/tmp/jl_wKdkBf/Manifest.toml` [ec057cc2] Structs v1.0.0 `https://github.com/quinnj/Structs.jl#jq-illegal-instruction#main` [2a0f44e3] Base64 [ade2ca70] Dates [b77e0a4c] InteractiveUtils [56ddb016] Logging [d6f4376e] Markdown [de0858da] Printf [9a3f8284] Random [ea8e919c] SHA v0.7.0 [9e88b42a] Serialization [8dfed614] Test [cf7118a7] UUIDs [4ec0a83e] Unicode Precompiling project... 1 dependency successfully precompiled in 2 seconds. 1 already precompiled. Testing Running tests... Dict{Symbol, Int} NamedTuple A struct AA struct B struct BB struct Vector Pair Vector Tuple C D Wrapper UndefGuy E G H I Vehicle J Recurs O Test Summary: | Pass Total Time Structs | 91 91 5.0s Testing Structs tests passed julia> ```
giordano commented 6 months ago

I can reproduce on

Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, haswell)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

dmesg shows

[ 7456.125562] traps: julia[56269] trap invalid opcode ip:75eb25f1d837 sp:7ffdd15dbee0 error:0

but in julia code I'm not sure how to find the assembly of the offending opcode.

gbaraldi commented 6 months ago

Can't reproduce on alder lake :(

fingolfin commented 4 months ago

@quinnj it seems your package was renamed, so I took the liberty of adjusting your reproducer steps.

I cannot reproduce this with 1.10.3 on two different systems:

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

and

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 128 × AMD EPYC 9554 64-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 128 virtual cores)

@giordano @quinnj can either of you repro the issue in 1.10.3?

giordano commented 4 months ago

can either of you repro the issue in 1.10.3?

I can still reproduce. But note I have haswell, you have znver3, and this is a SIGILL, so having a higher ISA explains why you can't reproduce.