darcs: ghc: Backport patch to fix GHC bug #10549, to unbreak shake’s test suite
Joachim Breitner
mail at joachim-breitner.de
Sun Aug 16 18:51:51 UTC 2015
Sun Aug 16 16:09:39 UTC 2015 Joachim Breitner <mail at joachim-breitner.de>
* Backport patch to fix GHC bug #10549, to unbreak shake[_<U+2019>_]s test suite
M ./changelog +6
A ./patches/Ensure-DynFlags-are-consistent
M ./patches/series +1
Sun Aug 16 16:09:39 UTC 2015 Joachim Breitner <mail at joachim-breitner.de>
* Backport patch to fix GHC bug #10549, to unbreak shakes test suite
diff -rN -u old-ghc/changelog new-ghc/changelog
--- old-ghc/changelog 2015-08-16 18:51:51.582123196 +0000
+++ new-ghc/changelog 2015-08-16 18:51:51.602123176 +0000
@@ -1,3 +1,9 @@
+ghc (7.10.2-2) UNRELEASED; urgency=medium
+
+ * Backport patch to fix GHC bug #10549, to unbreak shakeâs test suite
+
+ -- Joachim Breitner <nomeata at debian.org> Sun, 16 Aug 2015 15:05:03 +0200
+
ghc (7.10.2-1) experimental; urgency=medium
* New upstream release
diff -rN -u old-ghc/patches/Ensure-DynFlags-are-consistent new-ghc/patches/Ensure-DynFlags-are-consistent
--- old-ghc/patches/Ensure-DynFlags-are-consistent 1970-01-01 00:00:00.000000000 +0000
+++ new-ghc/patches/Ensure-DynFlags-are-consistent 2015-08-16 18:51:51.594123184 +0000
@@ -0,0 +1,113 @@
+Index: ghc-7.10/compiler/main/DynFlags.hs
+===================================================================
+--- ghc-7.10.orig/compiler/main/DynFlags.hs 2015-07-21 15:52:57.000000000 +0200
++++ ghc-7.10/compiler/main/DynFlags.hs 2015-08-16 14:57:09.000000000 +0200
+@@ -52,7 +52,7 @@
+ dynFlagDependencies,
+ tablesNextToCode, mkTablesNextToCode,
+ SigOf(..), getSigOf,
+- checkOptLevel,
++ makeDynFlagsConsistent,
+
+ Way(..), mkBuildTag, wayRTSOnly, addWay', updateWays,
+ wayGeneralFlags, wayUnsetGeneralFlags,
+@@ -4110,10 +4110,13 @@
+ 8 -> toInteger (maxBound :: Word64)
+ w -> panic ("tARGET_MAX_WORD: Unknown platformWordSize: " ++ show w)
+
++-- | Resolve any internal inconsistencies in a set of 'DynFlags'.
++-- Returns the consistent 'DynFlags' as well as a list of warnings
++-- to report to the user.
++makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String])
+ -- Whenever makeDynFlagsConsistent does anything, it starts over, to
+ -- ensure that a later change doesn't invalidate an earlier check.
+ -- Be careful not to introduce potential loops!
+-makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String])
+ makeDynFlagsConsistent dflags
+ -- Disable -dynamic-too on Windows (#8228, #7134, #5987)
+ | os == OSMinGW32 && gopt Opt_BuildDynamicToo dflags
+@@ -4152,6 +4155,8 @@
+ not (gopt Opt_PIC dflags)
+ = loop (gopt_set dflags Opt_PIC)
+ "Enabling -fPIC as it is always on for this platform"
++ | Left err <- checkOptLevel (optLevel dflags) dflags
++ = loop (updOptLevel 0 dflags) err
+ | otherwise = (dflags, [])
+ where loc = mkGeneralSrcSpan (fsLit "when making flags consistent")
+ loop updated_dflags warning
+@@ -4161,6 +4166,33 @@
+ arch = platformArch platform
+ os = platformOS platform
+
++{-
++Note [DynFlags consistency]
++~~~~~~~~~~~~~~~~~~~~~~~~~~~~
++
++There are a number of number of DynFlags configurations which either
++do not make sense or lead to unimplemented or buggy codepaths in the
++compiler. makeDynFlagsConsistent is responsible for verifying the validity
++of a set of DynFlags, fixing any issues, and reporting them back to the
++caller.
++
++GHCi and -O
++---------------
++
++When using optimization, the compiler can introduce several things
++(such as unboxed tuples) into the intermediate code, which GHCi later
++chokes on since the bytecode interpreter can't handle this (and while
++this is arguably a bug these aren't handled, there are no plans to fix
++it.)
++
++While the driver pipeline always checks for this particular erroneous
++combination when parsing flags, we also need to check when we update
++the flags; this is because API clients may parse flags but update the
++DynFlags afterwords, before finally running code inside a session (see
++T10052 and #10052).
++
++-}
++
+ --------------------------------------------------------------------------
+ -- Do not use unsafeGlobalDynFlags!
+ --
+Index: ghc-7.10/compiler/main/GHC.hs
+===================================================================
+--- ghc-7.10.orig/compiler/main/GHC.hs 2015-07-21 15:52:50.000000000 +0200
++++ ghc-7.10/compiler/main/GHC.hs 2015-08-16 14:57:09.000000000 +0200
+@@ -608,32 +608,15 @@
+ -> m (DynFlags, [Located String], [Located String])
+ parseDynamicFlags = parseDynamicFlagsCmdLine
+
+-{- Note [GHCi and -O]
+-~~~~~~~~~~~~~~~~~~~~~
+-When using optimization, the compiler can introduce several things
+-(such as unboxed tuples) into the intermediate code, which GHCi later
+-chokes on since the bytecode interpreter can't handle this (and while
+-this is arguably a bug these aren't handled, there are no plans to fix
+-it.)
+-
+-While the driver pipeline always checks for this particular erroneous
+-combination when parsing flags, we also need to check when we update
+-the flags; this is because API clients may parse flags but update the
+-DynFlags afterwords, before finally running code inside a session (see
+-T10052 and #10052).
+--}
+-
+ -- | Checks the set of new DynFlags for possibly erroneous option
+ -- combinations when invoking 'setSessionDynFlags' and friends, and if
+ -- found, returns a fixed copy (if possible).
+ checkNewDynFlags :: MonadIO m => DynFlags -> m DynFlags
+-checkNewDynFlags dflags
+- -- See Note [GHCi and -O]
+- | Left e <- checkOptLevel (optLevel dflags) dflags
+- = do liftIO $ warningMsg dflags (text e)
+- return (dflags { optLevel = 0 })
+- | otherwise
+- = return dflags
++checkNewDynFlags dflags = do
++ -- See Note [DynFlags consistency]
++ let (dflags', warnings) = makeDynFlagsConsistent dflags
++ liftIO $ handleFlagWarnings dflags warnings
++ return dflags'
+
+ -- %************************************************************************
+ -- %* *
diff -rN -u old-ghc/patches/series new-ghc/patches/series
--- old-ghc/patches/series 2015-08-16 18:51:51.582123196 +0000
+++ new-ghc/patches/series 2015-08-16 18:51:51.598123180 +0000
@@ -4,3 +4,4 @@
hurd.diff
buildpath-abi-stability.patch
reproducible-tmp-names
+Ensure-DynFlags-are-consistent
More information about the Pkg-haskell-commits
mailing list