Commit 818760d6 authored by Edward Z. Yang's avatar Edward Z. Yang

Fix #10923 by fingerprinting optimization level.

Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: simonmar, austin, bgamari, thomie, rwbarton

Differential Revision: https://phabricator.haskell.org/D2509

GHC Trac Issues: #10923
parent 0cc3931b
......@@ -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]
......
......@@ -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
......
......@@ -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
......@@ -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'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment