Commit b7ddf633 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Make initGhcMonad call setUnsafeGlobalDynFlags

If we don't do this, then in various GHC API scenarios
(which use runGhc) with tracing/debugging/ASSERTs on,
we try to read those unsafe global dynamic flags and
find them uninitialised.
parent 08a3536e
......@@ -444,16 +444,17 @@ runGhcT mb_top_dir ghct = do
-- <http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ghc-paths>.
initGhcMonad :: GhcMonad m => Maybe FilePath -> m ()
initGhcMonad mb_top_dir = do
-- catch ^C
liftIO $ installSignalHandlers
liftIO $ initStaticOpts
mySettings <- liftIO $ initSysTools mb_top_dir
dflags <- liftIO $ initDynFlags (defaultDynFlags mySettings)
env <- liftIO $ newHscEnv dflags
setSession env
initGhcMonad mb_top_dir
= do { env <- liftIO $
do { installSignalHandlers -- catch ^C
; initStaticOpts
; mySettings <- initSysTools mb_top_dir
; dflags <- initDynFlags (defaultDynFlags mySettings)
; setUnsafeGlobalDynFlags dflags
-- c.f. DynFlags.parseDynamicFlagsFull, which
-- creates DynFlags and sets the UnsafeGlobalDynFlags
; newHscEnv dflags }
; setSession env }
-- %************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment