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

GHC ghc-devs at haskell.org
Wed Feb 7 02:20:14 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):

 > It's not an entirely trivial task. We use uniques quite often to name
 symbols in code produced by the native codegen. Fixing this without
 compromising compiler performance is rather tricky.

 @bgamari Question:

 Why cannot the uniques be predetermined by a seed that's dependent on the
 module name?

 My understanding so far is this: We need an infinite stream of unused
 strings to generate symbols. Parallel compilation with `-j` and "partial"
 compilation of the projects (resumes, incremental compilation), means some
 number or pseudorandom generator has a different initial state when we
 come by the file next time.

 So couldn't we initialise the seed of that pseudorandom generator as
 `hash(module name)`, so that each time a module is compiled, it always
 generates the same uniques in the same order (as within a module there is
 no parallel compilation)? And when a module name changes, we have to
 recompile anyway and it's probably OK if the object code changes when that
 happens.

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


More information about the ghc-tickets mailing list