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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

crystal 0.20.0 Module validation failed #3584

Closed
faustinoaq opened this issue Nov 26, 2016 · 2 comments
Closed

crystal 0.20.0 Module validation failed #3584

faustinoaq opened this issue Nov 26, 2016 · 2 comments

Comments

@faustinoaq
Copy link
Contributor

Hi 馃憢

I'm trying to compile the following code:

# test.cr
a = 0
spawn do
  a = 1
end
sleep 1
puts a

And crystal 0.20.0 show me a bug:

$/opt/crystal/bin/crystal build -s -d test.cr
Using compiled compiler at .build/crystal
Parse:                             00:00:00.0002099 (   0.19MB)
Semantic (top level):              00:00:00.1612676 (  27.28MB)
Semantic (new):                    00:00:00.0015706 (  27.28MB)
Semantic (type declarations):      00:00:00.0333564 (  27.28MB)
Semantic (abstract def check):     00:00:00.0013453 (  27.28MB)
Semantic (cvars initializers):     00:00:00.0111769 (  27.28MB)
Semantic (ivars initializers):     00:00:00.0007451 (  27.28MB)
Semantic (main):                   00:00:00.1305432 (  43.34MB)
Semantic (cleanup):                00:00:00.0009511 (  43.34MB)
Semantic (recursive struct check): 00:00:00.0007060 (  43.34MB)
Codegen (crystal):                Module validation failed: inlinable function call in a function with debug info must have a !dbg location
  %10 = call i8* @__crystal_malloc(i32 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i32))

0x70feee: *raise<Exception>:NoReturn at ??
0x70fe27: ??? at ??
0x104f561: *LLVM::Module#verify:Nil at ??
0x104e1d7: *Crystal::CodeGenVisitor#finish:Hash(String, LLVM::Module) at ??
0xf896c1: *Crystal::Compiler#codegen<Crystal::Program, Crystal::ASTNode+, Array(Crystal::Compiler::Source), String>:(Array(String) | Nil) at ??
0x9835fc: *Crystal::Command#build:Crystal::Compiler::Result at ??
0x7a6588: *Crystal::Command#run:(Array(Crystal::ImplementationTrace) | Array(Crystal::Init::View+:Class) | Array(String) | Bool | Crystal::Compiler::Result | Hash(String, String) | IO::FileDescriptor | Nil) at ??
0x747126: main at ??
0x7f0573915291: __libc_start_main at ??
0x70f19a: _start at ??
0x0: ??? 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

Without the -d flag 0.20.0 works fine:

$ ./test 
1

The previous version (0.19.4) didn't show any problem with -d flag.

@faustinoaq
Copy link
Contributor Author

crystal 0.20.1 works fine now, Was this bug fixed?

@asterite asterite added this to the 0.20.2 milestone Dec 13, 2016
@asterite
Copy link
Member

@faustinoaq Crystal 0.20.1 still triggers the error for me, but it's fixed in master. Try doing crystal foo.cr -d or crystal foo.cr -d --emit llvm-ir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants