Opened 5 years ago

Closed 5 years ago

#7215 closed bug (fixed)

miscompilation due to broken interface hash

Reported by: akio Owned by: simonmar
Priority: highest Milestone: 7.6.2
Component: Compiler Version: 7.4.2
Keywords: Cc: hackage.haskell.org@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (5)

comment:1 Changed 5 years ago by liyang

Cc: hackage.haskell.org@… added

comment:2 Changed 5 years ago by simonmar

difficulty: Unknown
Milestone: 7.6.2
Owner: set to simonmar
Priority: normalhighest

Great bug report, thanks. I know what the problem is, fix on the way.

comment:3 Changed 5 years ago by marlowsd@…

commit 583c87d00d2058b1a073ea1f5d7f4e0d92b7a9a4

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Wed Sep 5 16:38:50 2012 +0100

    Fix #7215: we weren't calculating the hashes correctly for sub-binders

 compiler/iface/IfaceSyn.lhs |   22 ++++++++++++++++++++++
 compiler/iface/MkIface.lhs  |   17 ++---------------
 compiler/main/HscTypes.lhs  |   34 ++++++++++++++++------------------
 3 files changed, 40 insertions(+), 33 deletions(-)

comment:4 Changed 5 years ago by simonmar

Status: newmerge

comment:5 Changed 5 years ago by pcapriotti

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.