Crystal: crash when compiling: Module validation failed: Terminator found in the middle of a basic block!

Created on 9 Dec 2016  路  2Comments  路  Source: crystal-lang/crystal

I use Crystal 0.20.1
when I run crystal spec
the compiler crashes

Module validation failed: Terminator found in the middle of a basic block!
label %body
Call parameter type does not match function signature!
%Nil zeroinitializer
%"MXNet::NDArray"* %94 = call %"Array(MXNet::NDArray)"* @"Array(MXNet::NDArray)@Array(T)#<<:Array(MXNet::NDArray)"(%"Array(MXNet::NDArray)" %83, %Nil zeroinitializer)

0x105d660e3: *raise:NoReturn at ??
0x106a23cc1: *Crystal::CodeGenVisitor#finish:Hash(String, LLVM::Module) at ??
0x10697917d: *Crystal::Compiler#codegen:(Array(String) | Nil) at ??
0x105db949c: *Crystal::Command#run:(Array(Crystal::ImplementationTrace) | Array(Crystal::Init::View+:Class) | Array(String) | Bool | Crystal::Compiler::Result | Hash(String, String) | IO::FileDescriptor | Nil) at ??
0x105d8b23a: main at ??

Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

my code : https://github.com/chenkovsky/mxnet.cr/tree/compile_bug

bug compiler

Most helpful comment

Regardless of the bug, please read this

All 2 comments

Regardless of the bug, please read this

Reduced:

lib LibC
  fun exit(Int32) : NoReturn
end

def bar(x)
  x
end

def foo
  bar(yield 1)
end

foo do |x|
  LibC.exit(0) unless false
end
Was this page helpful?
0 / 5 - 0 ratings

Related issues

relonger picture relonger  路  3Comments

asterite picture asterite  路  3Comments

jhass picture jhass  路  3Comments

oprypin picture oprypin  路  3Comments

pbrusco picture pbrusco  路  3Comments