Skip to content

GHCi panics with small (e.g. `Word8#`, `Int16#`) literals

Summary

GHCi panics when it generates bytecode to return literals that are smaller than a machine word.

Steps to reproduce

Run the tests/parser/should_run/BinaryLiterals2.hs test from the testsuite with GHCi.

$ ghc -e main tests/parser/should_run/BinaryLiterals2.hs
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 9.1.20210311:
        GHC.StgToByteCode.bytesToWords: bytes=1

Expected behavior

The testcase should give the same result as when compiled, i.e. the contents of BinaryLiterals2.stdout

Environment

Recent GHC (9.1 / 9.2) branch. It looks like this was introduced by the sized Cmm improvements.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information