Skip to content

GHC crash after a few simple statements some of which erroneous

Summary

Well, ghci crashed a few lines after starting it. I could reproduce the event twice on 2 attempts. If you can't I can give more tries.

In both cases I'm pretty sure the crash happened upon me pressing Escape then j to go up in the history (I use set editing-mode vi in my .inputrc).

Steps to reproduce

This is truly the content of my terminal. Actually two of them, as I've reproduced it twice.

$ ghci
GHCi, version 9.2.7: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/enrico/.ghci
λ> data Account = { money :: Int }

<interactive>:1:16: error:
    Cannot parse data constructor in a data/newtype declaration:
      {money :: Int}
λ> data Account = Account { money :: Int }
λ> 
λ> 
λ> Account 3

<interactive>:5:1: error:
    • No instance for (Show Account) arising from a use of ‘print’
    • In a stmt of an interactive GHCi command: print it
λ> data Account = Account { money :: Int } derving (Show)

<interactive>:6:41: error: Not in scope: type variable ‘derving’
λ> data Account = Account { money :: Int } deriving Show
λ> 
λ> 
λ> Account 3
Account {money = 3}
λ> 
λ> 
λ> ghc: mmap 4096 bytes at (nil): Cannot allocate memory
ghc: Try specifying an address with +RTS -xm<addr> -RTS
Segmentation fault (core dumped)

Expected behavior

No crash

Environment

  • GHC version used: 9.2.7 (most recent "recommended" via ghcup tui)

Optional:

  • Operating System: ArchLinux up-to-date
  • System Architecture: 64bit (or you mean something else?)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information