summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2020-11-29 13:56:58 +0100
committerRoland Senn <rsx@bluewin.ch>2020-11-30 14:26:58 +0100
commit65ed2fdca2e0d0e8f3535b31f94dcdc1424e5cf2 (patch)
tree3b8fb3cdc0850f28d64c39a07ec07946eee4cd98 /compiler
parent2d72607e7b6346ad3e0a7fe39e86ceb8f85e557b (diff)
downloadhaskell-65ed2fdca2e0d0e8f3535b31f94dcdc1424e5cf2.tar.gz
Backport: Fix for #18955 to GHC 8.10 #18955
Since MR !554 (#15454) GHCi automatically enabled the flag `-fobject-code` on any module using the UnboxedTuples or UnboxedSum extensions. MR !1553 (#16876) allowed to inhibit the automatic compiling to object-code of these modules by setting the `fbyte-code` flag. However, it assigned 2 different semantics to this flag and introduced the regression described in issue #18955. This MR fixes this regression by unsetting the internal flag `Opt_ByteCodeIfUnboxed` before it's copied to DynFlags local to the module. In GHC 9.0.1 the issue is solved by introducing a new flag `-f(no-)object-code-if-unboxed`.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DynFlags.hs10
-rw-r--r--compiler/main/GhcMake.hs2
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 5fb1449f22..2ea0b3d5e9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -658,7 +658,7 @@ data GeneralFlag
| Opt_SingleLibFolder
| Opt_KeepCAFs
| Opt_KeepGoing
- | Opt_ByteCode
+ | Opt_ByteCodeIfUnboxed
-- output style opts
| Opt_ErrorSpans -- Include full span info in error messages,
@@ -3781,10 +3781,10 @@ dynamic_flags_deps = [
, make_ord_flag defFlag "fno-code" (NoArg ((upd $ \d ->
d { ghcLink=NoLink }) >> setTarget HscNothing))
- , make_ord_flag defFlag "fbyte-code"
- (noArgM $ \dflags -> do
- setTarget HscInterpreted
- pure $ gopt_set dflags Opt_ByteCode)
+ , make_ord_flag defFlag "fbyte-code" (NoArg ((upd $ \d ->
+ -- Enabling Opt_ByteCodeIfUnboxed is a workaround for #18955.
+ -- See the comments for resetOptByteCodeIfUnboxed for more details.
+ gopt_set d Opt_ByteCodeIfUnboxed) >> setTarget HscInterpreted))
, make_ord_flag defFlag "fobject-code" $ NoArg $ do
dflags <- liftEwM getCmdLineState
setTarget $ defaultObjectTarget dflags
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 6599da07f4..dc8344d14d 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -2185,7 +2185,7 @@ enableCodeGenForUnboxedTuplesOrSums =
where
condition ms =
unboxed_tuples_or_sums (ms_hspp_opts ms) &&
- not (gopt Opt_ByteCode (ms_hspp_opts ms)) &&
+ not (gopt Opt_ByteCodeIfUnboxed (ms_hspp_opts ms)) &&
not (isBootSummary ms)
unboxed_tuples_or_sums d =
xopt LangExt.UnboxedTuples d || xopt LangExt.UnboxedSums d