Yaml.parse fails with invalid memory access, but only in release builds using llvm-11

I ran into a problem compiling crystalline from source. After trying to isolate the problem, the problem seems to be with YAML.parse.

 require "yaml"
 text = "---\nName: jane doe\n"
 yml = YAML.parse(text)
 puts yml["Name"].to_s

This works with prebuilt crystal 0.36, both in normal and release builds.

with crystal built from source using llvm-11 and using --release, i get an error

{Invalid memory access (signal 11) at address 0x18
[0x564fb681a6c6] print_backtrace at /usr/share/crystal/src/exception/call_stack.cr:129:5
[0x564fb68018f2] __crystal_sigfault_handler at /usr/share/crystal/src/signal.cr:348:3
[0x7f9e9a4bb140] ???
[0x564fb6815141] year_month_day_day_year at /usr/share/crystal/src/time/location.cr:393:12
[0x564fb681235e] check_char at /usr/share/crystal/src/time.cr:764:5
[0x564fb6811d60] visit at /usr/share/crystal/src/time/format/pattern.cr:8:18
[0x564fb680f631] inspect at /usr/share/crystal/src/time.cr:1043:7
[0x564fb68113e2] to_s at /usr/share/crystal/src/slice.cr:69:56
[0x564fb67db791] __crystal_main at /usr/share/crystal/src/yaml/any.cr:288:5
[0x564fb67e0d67] main at /usr/share/crystal/src/crystal/main.cr:110:5
[0x7f9e9a28dd0a] __libc_start_main +234
[0x564fb67d879a] _start +42
[0x0] ???

crystal build info

crystal --version
Crystal 1.0.0-dev [be5de4ac1] (2021-01-26)

LLVM: 11.0.1
Default target: x86_64-pc-linux-gnu

I saw some issues about invalid memory access in release builds. Not sure if this is related.

The output of --emit llvm-ir is too large to paste here. Please let me know if i can provide any more details to narrow down the issue

It seems to be this bug: LLVM 11 optimizations breaks code · Issue #10220 · crystal-lang/crystal · GitHub