Skip to content

recompilation checker overeager on executables produced with -o

-- Foo.hs
module Main where

main :: IO ()
main = putStrLn "foo"
-- Bar.hs
module Main where

main :: IO ()
main = putStrLn "bar"
ghc --make Foo.hs -o hello
ghc --make Bar.hs -o hello

The first runthough this is fine. Any subsequent invocation of either of the above commands won't create a new executable again, even if the existing one is for "foo" and the command is invoked with "bar" or vice-versa. My guess is it sees that the *.hi and *.o files are up to date and sees the mtime of the executable is chronologically subsequent, so doesn't account for the fact that the file being compiled to an executable could itself have been changed.

I don't know how fixable this is without always recompiling the executable, which is of course to be avoided. #13829 seems like it might be the flip-side of the same coin, so maybe fixing one also lets us fix the other...

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information