Opened 2 years ago

Closed 2 years ago

#5614 closed bug (fixed)

recompilation bug with -O

Reported by: gmi001 Owned by: simonmar
Priority: high Milestone: 7.4.1
Component: Compiler Version: 7.2.1
Keywords: recompilation Cc: gerard.michels@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Recompilation with -O should also rebuild Main.hs in the attached test application consisting of Main.hs and X.hs.

Test case:

1) build the app with GHC --make -O Main.hs

2) run Main (output = B)

3) change and save in X.hs

x = D { f = B }

to

x = D { f = A }

4) rebuild the app with GHC --make -O Main.hs (recompiles only X.hs)

5) run Main (unexpected output = B)

6) force recompilation of both X.hs and Main.hs

7) run Main (output = A)

The bug is in -O.
A similar test with f :: String instead of f :: D2 runs without problems.

Problem is tested positive on WIN GHC 7.0.2, OpenSuse? GHC 6.12.3, Mac OS X GHC 7.0.3 and GHC 7.2.1 (MAC?).

for more detail see http://sourceforge.net/apps/trac/ampersand/ticket/172.

the closed #1959 and #3166 describe similar problems.

Attachments (2)

Main.hs (68 bytes) - added by gmi001 2 years ago.
X.hs (130 bytes) - added by gmi001 2 years ago.

Download all attachments as: .zip

Change History (6)

Changed 2 years ago by gmi001

Changed 2 years ago by gmi001

comment:1 Changed 2 years ago by gmi001

  • Cc gerard.michels@… added

comment:2 Changed 2 years ago by simonmar

  • Milestone set to 7.4.1
  • Owner set to simonmar
  • Priority changed from normal to high

comment:3 Changed 2 years ago by marlowsd@…

commit a77a68e75f437882d1bcc8e5208fa35c271ace8d

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Thu Nov 10 15:47:44 2011 +0000

    Give sub-binders different fingerprints (#5614)
    
    This is a pretty egregious mistake in the recompilation checker: in a
    declaration with multiple binders (e.g. data T = A | B) we were giving
    all the binders the same fingerprint when referenced, so e.g. an
    unfolding that mentioned A would get the same fingerprint as if it
    mentioned B instead.  The fix is of course to give them all different
    fingerprints.

 compiler/iface/MkIface.lhs |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

comment:4 Changed 2 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

Really nice bug report, thankyou!

Note: See TracTickets for help on using tickets.