Open silverweed opened 6 years ago
Bump: problem is still there with 0.24.2. Can this at least be labeled as a compiler bug?
Compiled a debug LLVM and got this error:
Cannot create a null constant of that type!
UNREACHABLE executed at ../lib/IR/Constants.cpp:239!
This happens when calling LLVM::Type#null
on a LLVM::Type
which is Void
. Happens during codegen.
After some compat patches this now produces the following under Crystal 0.33
Module validation failed: Load operand must be a pointer.
%24 = load void, void <badref>
PHI node operands are not the same type as the result!
%25 = phi i32 [ 0, %nil ], [ %24, %not_nil ]
Call parameter type does not match function signature!
call void @"*Nil#not_nil!:NoReturn"(%Nil zeroinitializer)
i32* call void @"*SF::Sprite#texture=<SF::Texture+>:Nil"(%"SF::Sprite"* %6, void <badref>)
Invalid operand types for ICmp instruction
%32 = icmp eq void <badref>, zeroinitializer
Load operand must be a pointer.
%33 = load void, void <badref>
PHI node operands are not the same type as the result!
%34 = phi i32 [ 0, %nil1 ], [ %33, %not_nil2 ]
Load operand must be a pointer.
%36 = load void, void <badref>
Call parameter type does not match function signature!
%36 = load void, void <badref>
i32 %37 = call i32 @"~metaclass"(void %36)
(Exception)
from Crystal::CodeGenVisitor#finish:Nil
from Crystal::Compiler#codegen<Crystal::Program, Crystal::ASTNode+, Array(Crystal::Compiler::Source), String>:(Tuple(Array(Crystal::Compiler::CompilationUnit), Array(String)) | Nil)
from Crystal::Compiler#compile<Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result
from Crystal::Command#run:(Bool | Crystal::Compiler::Result | Nil)
from main
Crystal version: Crystal 0.24.1 (2017-12-20)
LLVM: 5.0.0 Default target: x86_64-unknown-linux-gnu
OS version: Linux 4.14.8-1-ARCH #1 SMP PREEMPT Wed Dec 20 21:27:44 UTC 2017 x86_64 GNU/Linux
I have a Crystal project I haven't been updating since november. It used to compile fine with Crystal 0.23, but since I upgraded to 0.24 the compiler crashes while compiling it. It doesn't print the usual message "You have found a bug in the compiler", it just aborts. I tried this both on Debian testing and on Archlinux, and on the latter it doesn't simply crash, but it reports a stack smashing detection:
Since the codebase is not that small (~1900 loc) I haven't been able to write a minimal example, but via
git bisect
I could track down the commit after which the compiler is unable to compile the app. Unfortunately it's quite a big commit involving several files, all of which compile just fine when compiled standalone.I built the compiler from source with debug enabled and this is what
gdb
spits out (using an external link as it's pretty long): GDB outputAre there any more steps I can take to narrow the possible causes?