[GHC] #12935: Object code produced by GHC is non-deterministic

GHC ghc-devs at haskell.org
Sun Feb 11 15:59:42 UTC 2018


#12935: Object code produced by GHC is non-deterministic
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nh2):

 I'm looking into doing this. First a remark:

 Instead of hashing for extra stability, we could also just use the
 increasing `[1 of 3] Compiling A` numbers for unique namespacing. But I
 noticed that the order of those is currently not stable:

 In a project with modules `A, B, C, Main`, `A` imports nothing, `B` and
 `C` both import `A`, `Main` imports `C` and `D`, sometimes you will get a
 different output of which of these modules is `[3 of 4]`. Example:

 {{{
 % touch B.hs && /raid/src/ghc/git-8.2.1/inplace/bin/ghc-stage2 --make
 Main.hs
 [3 of 4] Compiling B
 ...
 }}}

 {{{
 % touch C.hs && /raid/src/ghc/git-8.2.1/inplace/bin/ghc-stage2 --make
 Main.hs
 [3 of 4] Compiling C
 ...
 }}}

 That is because in `GhcMake.upsweep'` the `mod_index` is just counting up
 `+1`, but over `sccs :: [SCC ModSummary]` the order of which is somehow
 influenced by the file mtime (I haven't found yet how the mtime makes it
 to be a more significant field than the module name).

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


More information about the ghc-tickets mailing list