Crystal: Crystal v0.30.1 and v0.30.0 segfaults on a specific code base

Created on 19 Aug 2019  路  4Comments  路  Source: crystal-lang/crystal

https://github.com/shdown/isekai/tree/927e3a62101efbed123596226cada1b5e2621360

$ crystal v
Crystal 0.30.1 [5e6a1b672] (2019-08-12)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
$ make
crystal build src/isekai.cr
Invalid memory access (signal 11) at address 0x3fd01
[0x7f9d8bbaa7d6] ???
[0x7f9d8bac28a0] ???
[0x7f9d8cff14d7] ???
make: *** [Makefile:2: isekai] Error 11
bug compiler

All 4 comments

Reduced the code size needed to reproduce, see https://github.com/shdown/crystal-segfault

Reduced:

def foo
  x = 1
  yield x if x.is_a?(Char)
  yield x if x.is_a?(Int32)
end

foo { |x| }

Weird, carc.in doesn't segfault on your reduction @asterite, but gives a compiler bug https://carc.in/#/r/7fcf BUG: trying to assign Nil <- Int32

Are you sure it's the same problem?

Yes, it's the same issue. The segfault happens for him in the compiler for some reason, I don't know why.

Or, well, @shdown would have to try compiling it with master compiled.

Was this page helpful?
0 / 5 - 0 ratings