miscompilation due to broken interface hash
The following script should print '!MyFalse !MyTrue' but it prints '!MyFalse !MyFalse'. (warning: it removes files in the current directory)
rm -f main main.o main.hi MyBool.hi MyBool.o Foo.hi Foo.o
ghc=ghc
echo 'module MyBool where data MyBool = MyFalse | MyTrue deriving Show' > MyBool.hs
echo 'module Foo where import MyBool; foo = MyFalse' > Foo.hs
echo 'import Foo; main = print foo' > main.hs
$ghc -c -O2 MyBool.hs
$ghc -c -O2 Foo.hs
$ghc -O2 main.hs
./main
echo 'module Foo where import MyBool; foo = MyTrue' > Foo.hs
$ghc -c -O2 Foo.hs
$ghc -O2 main.hs
./main
The issue seems to be that the second version of Foo.hs gets the same interface hash as the old one. This stops GHC from updating Foo.hi, which contains an outdated unfolding.
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |