How to enable verbose output from compiler?

Is there any option to turn on verbose output from compiler? Or to see what is causing the crash? Enabling stats reveal that crash happening on codegen phase, but it doesn’t reveal much details.

Crash i’m experiencing is what is detailed in issue BUG: `def consume_substitution - crystal/src/string/ has no type (Exception) · Issue #12825 · crystal-lang/crystal · GitHub

Parse:                             00:00:00.000021208 (   0.77MB)
Semantic (top level):              00:00:00.925142750 ( 333.28MB)
Semantic (new):                    00:00:00.002626875 ( 333.28MB)
Semantic (type declarations):      00:00:00.050702333 ( 333.28MB)
Semantic (abstract def check):     00:00:00.017858541 ( 333.28MB)
Semantic (restrictions augmenter): 00:00:00.010660833 ( 333.28MB)
Semantic (ivars initializers):     00:00:00.954115750 ( 365.28MB)
Semantic (cvars initializers):     00:00:01.394070958 ( 701.70MB)
Semantic (main):                   00:00:00.896384167 ( 798.20MB)
Semantic (cleanup):                00:00:00.001196666 ( 798.20MB)
Semantic (recursive struct check): 00:00:00.001653792 ( 798.20MB)
BUG: `def consume_substitution
  key = consume_substitution_key('}')
end` at /opt/homebrew/Cellar/crystal/1.7.2/share/crystal/src/string/ has no type (Exception)
  from /opt/homebrew/Cellar/crystal/1.7.2/libexec/crystal in 'raise<Exception>:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.7.2/libexec/crystal in 'raise<String>:NoReturn'

captured recording can bee seen at untitled - asciinema

Any insight or guidance is highly appreciated.

Besides the stack trace, I don’t think there’s more information available

The best way forward is to try to minimize the code to find what’s causing it.

Thanks. True and that was the reason me falling back to this forum to learn if there are some ways to dig out some clues on what might be causing compiler crash.

Seems there is no good way other than finding the needle in the haystack.

Duplicate of BUG: `def consume_formatted_substitution ... at .../string/ has no type · Issue #7461 · crystal-lang/crystal · GitHub

1 Like

To help find that needle in the haystack, there is Dustmite.

I had good experience with that tool, when trying to find the bit of my code that was upsetting the code generator in the Dlang compiler.

Thanks. That’s quite a good tool but specific to D lang, unfortunately we don’t have something like this in Crystal ecosystem.