Internal error when compiling TH code with profiling on Windows
When using the GHC API with this minimal example, compiled with profiling enabled:
module Main where
import GHC
import GHC.Paths ( libdir )
main = runGhc (Just libdir) $ do
env <- getSession
dflags <- getSessionDynFlags
setSessionDynFlags 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:
testprof.exe: internal error: IMAGE_REL_AMD64_ADDR32[NB]: High bits are set in 10e6109d0 for .text
(GHC version 8.2.1 for x86_64_unknown_mingw32)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
The walkaround is to use -fexternal-interpreter, in that case, the crash does not happen.
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 | Unknown/Multiple |
Architecture |