Skip to content

External TH interpreter crashes with ghc: ghc-iserv terminated (-6)

Summary

The options to profile Template Haskell seem to crash with ghc: ghc-iserv terminated (-6)

Steps to reproduce

The following program crashes for me:

{-# LANGUAGE TemplateHaskell  #-}

{-# OPTIONS_GHC -pgmi /home/sandy/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.2/lib/ghc-8.8.2/bin/ghc-iserv-prof -fexternal-interpreter -opti+RTS -opti-p #-}

module ListPresentation where

blah = $([e| undefined |])

Note that I'm running this via stack, thus the janky -pgmi option. I'm compiling with the following flags: --enable-library-profiling --enable-profiling --ghc-options -fprof-auto --ghc-options -fprof-cafs.

Result:

ghc-iserv-prof: internal error: PAP object entered!
    (GHC version 8.8.2 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

/home/sandy/prj/algebra-checkers/src/ListPresentation.hs:8:8: error:
    • Exception when trying to run compile-time code:
        ghc: ghc-iserv terminated (-6)
      Code: [| undefined |]
    • In the untyped splice: $([| undefined |])
  |
8 | blah = $([e| undefined |])
  |        ^^^^^^^^^^^^^^^^^^^

Expected behavior

I expect the splice to work properly, and for me to get a profile dump.

Environment

  • GHC version used: 8.8.2, and I'm also seeing it on 8.6.5
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information