diff options
-rw-r--r-- | compiler/iface/FlagChecker.hs | 10 | ||||
-rw-r--r-- | compiler/utils/Binary.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/driver/Makefile | 7 | ||||
-rw-r--r-- | testsuite/tests/driver/T10923.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/driver/all.T | 7 |
5 files changed, 33 insertions, 3 deletions
diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index ca8cf28a09..b3f3758746 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -45,8 +45,14 @@ fingerprintDynFlags dflags@DynFlags{..} this_mod nameio = -- -fprof-auto etc. prof = if gopt Opt_SccProfilingOn dflags then fromEnum profAuto else 0 - in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $ - computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof) + -- -O, see https://ghc.haskell.org/trac/ghc/ticket/10923 + opt = if hscTarget == HscInterpreted || + hscTarget == HscNothing + then 0 + else optLevel + + in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths, prof, opt)) $ + computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof, opt) {- Note [path flags and recompilation] diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 9f7c03dbcc..c3814cd908 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -420,6 +420,17 @@ instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary f <- get bh return (a,b,c,d,e,f) +instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a,b,c,d,e,f,g) where + put_ bh (a,b,c,d,e,f,g) = do put_ bh a; put_ bh b; put_ bh c; put_ bh d; put_ bh e; put_ bh f; put_ bh g + get bh = do a <- get bh + b <- get bh + c <- get bh + d <- get bh + e <- get bh + f <- get bh + g <- get bh + return (a,b,c,d,e,f,g) + instance Binary a => Binary (Maybe a) where put_ bh Nothing = putByte bh 0 put_ bh (Just a) = do putByte bh 1; put_ bh a diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile index 8069331fcb..4e9ef20f41 100644 --- a/testsuite/tests/driver/Makefile +++ b/testsuite/tests/driver/Makefile @@ -629,3 +629,10 @@ T12135: cp T12135b.h T12135b/T12135.h "$(TEST_HC)" $(TEST_HC_OPTS) -IT12135b -IT12135a --make T12135.hs ./T12135 + +.PHONY: T10923 +T10923: + $(RM) -rf T10923.o T10923.hi + "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c T10923.hs + # should NOT output "compilation is NOT required" + "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O -c T10923.hs diff --git a/testsuite/tests/driver/T10923.hs b/testsuite/tests/driver/T10923.hs new file mode 100644 index 0000000000..8e2ddcd93f --- /dev/null +++ b/testsuite/tests/driver/T10923.hs @@ -0,0 +1 @@ +module T10923 where diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index ebd1b5af7f..c6283df156 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -491,4 +491,9 @@ test('T12135', run_command, ['$MAKE -s --no-print-directory T12135']) -test('T12192', normal, run_command, ['mkdir foo && (cd foo && {compiler} -v0 ../T12192)'])
\ No newline at end of file +test('T12192', normal, run_command, ['mkdir foo && (cd foo && {compiler} -v0 ../T12192)']) + +test('T10923', + extra_clean(['T10923.o', 'T10923.hi']), + run_command, + ['$MAKE -s --no-print-directory T10923']) |