[GHC] #4012: Compilation results are not deterministic

GHC ghc-devs at haskell.org
Tue Oct 27 15:17:58 UTC 2015


#4012: Compilation results are not deterministic
-------------------------------------+-------------------------------------
        Reporter:  kili              |                Owner:  niteria
            Type:  bug               |               Status:  patch
        Priority:  high              |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  6.12.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10424            |  Differential Rev(s):  Phab:D910,
                                     |  Phab:D1073, Phab:D1133, Phab:D1192,
       Wiki Page:                    |  Phab:D1268
-------------------------------------+-------------------------------------

Comment (by Austin Seipp <austin@…>):

 In [changeset:"ffcdd84f86727c1621be0a0e522eb6a3a64e479f/ghc" ffcdd84/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="ffcdd84f86727c1621be0a0e522eb6a3a64e479f"
 Sort field labels before fingerprint hashing

 `fsEnvElts :: FastStringEnv a -> [a]` returns a list of `[a]` in the order
 of
 `Unique`s which is arbitrary. In this case it gives a list of record
 fields in
 arbitrary order, from which we then extract the field labels to contribute
 to
 the record fingerprint. The arbitrary ordering of field labels introduces
 unnecessary nondeterminism in interface files as demonstrated by the test
 case.

 We sort `FastString` here. It's safe, because the only way that the
 `Unique`
 associated with the `FastString` is used in comparison is for equality. If
 the
 `Unique`s are different it fallbacks to comparing the actual `ByteString`.

 Reviewed By: ezyang, thomie, bgamari, austin

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

 GHC Trac Issues: #4012
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/4012#comment:128>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list