Internal error when linker is initialized with -fexternal-interpreter set when compiling TH code with profiling
When using the GHC API with this minimal example, using the -fexternal-interpreter option, compiled with profiling enabled:
import GHC
import Control.Monad.IO.Class
import GHC.Paths ( libdir )
import DynFlags
import Linker
main = runGhc (Just libdir) $ do
env <- getSession
dflags <- getSessionDynFlags
liftIO $ initDynLinker env
setSessionDynFlags (setGeneralFlag' Opt_ExternalInterpreter dflags)
target <- guessTarget "A.hs" Nothing
setTargets [target]
load LoadAllTargets
Invoking the main executable:
testprof
While A.hs contains a TH splice:
{-# LANGUAGE TemplateHaskell #-}
module A where
$(return [])
The compiler crashes:
Access violation in generated code when writing 0000000000000024
Probably I'm misusing the API in this example, but the way it crashes is suspicious.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHC API |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |