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

illegal instruction crash #3852

Closed
mlubin opened this issue Jul 27, 2013 · 3 comments
Closed

illegal instruction crash #3852

mlubin opened this issue Jul 27, 2013 · 3 comments
Assignees

Comments

@mlubin
Copy link
Member

mlubin commented Jul 27, 2013

I've run into an Illegal instruction (core dumped) crash by trying to run some old code. I can reproduce the crash on two linux 64-bit machines using 1613b3b.

I've removed much of the surrounding code to get a 150-line test case which always crashes: https://gist.github.com/mlubin/6095957. JuMP must be installed. Unfortunately I couldn't simplify it any more than this.

The GDB backtrace isn't very helpful:

Program received signal SIGILL, Illegal instruction.
0x00007ffff33061fa in ?? ()
(gdb) backtrace
#0  0x00007ffff33061fa in ?? ()
#1  0x0000000004886cb0 in ?? ()
#2  0x0000000000000040 in ?? ()
#3  0x00007fffffffd360 in ?? ()
#4  0x0000000004db4700 in ?? ()
#5  0x0000000004db4670 in ?? ()
#6  0x00000000028f4140 in ?? ()
#7  0x0000000004db45b0 in ?? ()
#8  0x0000000002320a40 in ?? ()
#9  0x00000000068502d0 in ?? ()
#10 0x0000000002bbde40 in ?? ()
#11 0x0000000000000000 in ?? ()
@ghost ghost assigned JeffBezanson Jul 28, 2013
@vtjnash
Copy link
Member

vtjnash commented Jul 28, 2013

llvm is generating an instruction there defined to be undefined.
If we turn on the function verifier, we can almost see why:

julia> disassemble(dobench,())
Instruction does not dominate all uses!
  %142 = load %jl_value_t** %58, !dbg !8625
  %185 = bitcast %jl_value_t* %142 to %jl_value_t**, !dbg !8630
Instruction does not dominate all uses!
  %142 = load %jl_value_t** %58, !dbg !8625
  call void @jl_type_error_rt(i8* getelementptr inbounds ([8 x i8]* @_j_str301, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8]* @_j_str19, i32 0, i32 0), %jl_value_t* inttoptr (i64 4328618496 to %jl_value_t*), %jl_value_t* %142), !dbg !8630
Instruction does not dominate all uses!
  %142 = load %jl_value_t** %58, !dbg !8625
  %191 = bitcast %jl_value_t* %142 to %jl_value_t**, !dbg !8630
Instruction does not dominate all uses!
  %142 = load %jl_value_t** %58, !dbg !8625
  %202 = call %jl_value_t* %194(%jl_value_t* %142, %jl_value_t** %201, i32 2), !dbg !8630
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Module Verifier' on function '@julia_dobench'
Illegal instruction: 4
~/Documents/no-backup/julia$ 

Doing some manual digging, the fault is in line 138, which is finfer'd as follows:

        elts::Union(Undef,Function)(xval::Union(AbstractArray{T,N},Undef),nzval::Union(Undef,Array{Float64,1}))

@vtjnash
Copy link
Member

vtjnash commented Jul 28, 2013

simplified test-case:

julia> function f()
         local x     
         for i = 1:10
           x = println
         end
         x("hi")
       end
# methods for generic function f
f() at none:2

verifier on:

julia> f()
Instruction does not dominate all uses!
  %12 = load %jl_value_t** inttoptr (i64 4357935664 to %jl_value_t**), !dbg !4985
  %15 = bitcast %jl_value_t* %12 to %jl_value_t**, !dbg !4986
Instruction does not dominate all uses!
  %12 = load %jl_value_t** inttoptr (i64 4357935664 to %jl_value_t**), !dbg !4985
  call void @jl_type_error_rt(i8* getelementptr inbounds ([2 x i8]* @_j_str209, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8]* @_j_str19, i32 0, i32 0), %jl_value_t* inttoptr (i64 4328618496 to %jl_value_t*), %jl_value_t* %12), !dbg !4986
Instruction does not dominate all uses!
  %12 = load %jl_value_t** inttoptr (i64 4357935664 to %jl_value_t**), !dbg !4985
  %21 = bitcast %jl_value_t* %12 to %jl_value_t**, !dbg !4986
Instruction does not dominate all uses!
  %12 = load %jl_value_t** inttoptr (i64 4357935664 to %jl_value_t**), !dbg !4985
  %27 = call %jl_value_t* %24(%jl_value_t* %12, %jl_value_t** %26, i32 1), !dbg !4986
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Module Verifier' on function '@julia_f'
Illegal instruction: 4

verifier off (assertions on):

julia> f()
Assertion failed: (L->isLCSSAForm(*DT)), function runOnLoop, file /Users/jameson/Documents/no-backup/julia/deps/llvm-3.2/lib/Transforms/Utils/LCSSA.cpp, line 170.
Stack dump:
0.  Running pass 'Loop Pass Manager' on function '@julia_f1142'
1.  Running pass 'Loop-Closed SSA Form Pass' on basic block '%L'
Illegal instruction: 4

@mlubin
Copy link
Member Author

mlubin commented Jul 28, 2013

Nice digging!

KristofferC pushed a commit that referenced this issue Mar 26, 2024
Stdlib: Pkg
URL: https://github.com/JuliaLang/Pkg.jl.git
Stdlib branch: master
Julia branch: master
Old commit: 6859d6857
New commit: 162634c56
Julia version: 1.12.0-DEV
Pkg version: 1.12.0
Bump invoked by: @KristofferC
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/Pkg.jl@6859d68...162634c

```
$ git log --oneline 6859d6857..162634c56
162634c56 Add workspace feature (#3841)
a4ec712eb Remove outdated UUID instructions (#3855)
9c6356fa9 collect e.g. weak deps from project even if it is not a package (#3852)
```

Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
IanButterworth pushed a commit that referenced this issue Oct 7, 2024
…0d22b (#56032)

Stdlib: Pkg
URL: https://github.com/JuliaLang/Pkg.jl.git
Stdlib branch: release-1.11
Julia branch: backports-release-1.11
Old commit: 6ceafca8e
New commit: aba90d22b
Julia version: 1.11.0
Pkg version: 1.11.0
Bump invoked by: @IanButterworth
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaLang/Pkg.jl@6ceafca...aba90d2

```
$ git log --oneline 6ceafca8e..aba90d22b
aba90d22b Merge pull request #4037 from JuliaLang/backports-release-1.11
76eaa4caa Fix julia#55850 by using safe_realpath instead of abspath in projname (#4025)
df38587fb warn if General is installed via the old slow methods (#4022)
1475b628a update package extension naming docs (#4000)
72dc85e80 Tweak sentence syntax in getting-started.md (#4020)
0b2397089 make `add` and `dev` on a package remove it from the set of weak dependencies (#3865)
ee2d51054 collect e.g. weak deps from project even if it is not a package (#3852)
```

Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants