[commit: ghc] master: Make initGhcMonad call setUnsafeGlobalDynFlags (b7ddf63)

git at git.haskell.org git at git.haskell.org
Fri Jan 10 18:17:07 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7ddf6337760c65f22110937da09cd169cd3e8b3/ghc

>---------------------------------------------------------------

commit b7ddf6337760c65f22110937da09cd169cd3e8b3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jan 10 18:16:34 2014 +0000

    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.


>---------------------------------------------------------------

b7ddf6337760c65f22110937da09cd169cd3e8b3
 compiler/main/GHC.hs |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 1b6ea2d..6b2815a 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 }
 
 
 -- %************************************************************************



More information about the ghc-commits mailing list