summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-01-10 18:16:34 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-01-10 18:16:52 +0000
commitb7ddf6337760c65f22110937da09cd169cd3e8b3 (patch)
treed1ee9805916ded298220c0b7cd0ae592020634a9 /compiler/main/GHC.hs
parent08a3536e4246e323fbcd8040e0b80001950fe9bc (diff)
downloadhaskell-b7ddf6337760c65f22110937da09cd169cd3e8b3.tar.gz
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.
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r--compiler/main/GHC.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 1b6ea2d26e..6b2815a4ee 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -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 }
-- %************************************************************************