The following doesn't matter what type is provided when using uninitialized it will crash with an Invalid memory access from crystal play.
class Apple
@@apple = uninitialized Array
def self.look
@@apple
end
end
Apple.look
Invalid memory access (signal 11) at address 0x7f3a19d12fd8
[5750941] __crystal_sigfault_handler +61
[40688676] sigfault_handler +40
[139887644436016] ???
[7071954] ???
[7071959] ??? (87276 times)
[26376526] ???
[26376676] ???
[11709762] ???
[11719669] ???
[11709286] ???
[11719669] ???
[18245202] ???
[17053176] ???
[17042051] ???
[28236301] ???
[28622240] ???
[28609057] ???
[28328477] ???
[5626056] ???
[0] ???
crystal -v = "Crystal 0.20.5 [ccf46c0] (2017-01-20)"
Ubuntu Linux 16.10
Also crashes the compiler, so the playground isn't involved.
With uninitialized being explicitly unsafe isn't this to be expected? What would a uninitialized Array even look like?
Probably expected, but I guess at the very least it shouldn't crash the playground downstream
Note that this is a bug in the compiler, because of uninitialized Array. That shouldn't compile, but right now it crashes (literally) the compiler's process, and it takes down the playground too (because it's the same process)
Most helpful comment
Also crashes the compiler, so the playground isn't involved.