This is the line which caused the error: https://github.com/sherjilozair/cudnn.cr/blob/master/spec/cudnn_spec.cr#L18
The relevant pieces of code are:
describe CuDNN do
it "allocates memory" do
p = ::CuDNN.malloc(100)
p.should be_a(Pointer(Void))
end
end
which calls
module CuDNN
extend self
def malloc(size)
check_success(LibCUDA.malloc(out ptr, size))
return ptr
end
end
which calls
@[Link("cudart")]
lib LibCUDA
enum ErrorT
Success
end
fun malloc = cudaMalloc(ptr : Void**, size : LibC::Int) : ErrorT
end
The error is:
Module validation failed: Incorrect number of arguments passed to called function!
%0 = call %"String::Builder"* @"*Pointer(Void)@Object::to_s<String::Builder>:String::Builder"(i32 %obj, %"String::Builder"* %self), !dbg !148
???
???
???
???
???
???
???
???
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
This was caused due to using p as a variable name. Apparently, p is a keyword in Crystal. Closing, since it's not a bug.
If module validation fails, it's a compiler bug, regardless of whether the input is valid or not.
p is not a keyword but a global method. It shouldn't be an issue if you name a local variable p.
Note that the reduced code doesn't reproduce the bug. Someone will have to remove the real bug from the git repo.
@bararchy fixed this on the repository, so he might have more information on how to extract the bug.
Most helpful comment
If module validation fails, it's a compiler bug, regardless of whether the input is valid or not.
pis not a keyword but a global method. It shouldn't be an issue if you name a local variablep.