Re: [GHC] #4012: Compilation results are not deterministic

#4012: Compilation results are not deterministic -------------------------------------+------------------------------------- Reporter: kili | Owner: Fuuzetsu Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 6.12.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Difficult (2-5 Type of failure: Other | days) Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Fuuzetsu): I got a test case: I took http-client, a library that was notorious for non-deterministic ABIs, found a small module without any internal imports and stripped it down. It seems that this can be exhibited by nearly any compilation as long as you are compiling more than one module at once: {{{ghc -O -j2 Foo}}} will, AFAICT, for the simple case, result in the same ABI pretty much always. {{{ghc -O -j2 Foo Bar}}} will often not, but how often depends on the content of each. {{{Foo}}} and {{{Bar}}} can be completely independent, not importing each other. Probably going to be looking at uniqs and that {{{unsafeInterleaveIO}}} (thanks to Duncan for pointing it out) but needed a test case first. I attach two modules, {{{T}}} and {{{S}}}: they are not ‘trivial’ modules because with those the ABI hash changes much less frequently. These modules only import the libraries that ship with GHC so it is easy to hack on. Follows a sample session with 7.8.3: {{{ [shana@lenalee:~/programming/ghc-nondeterminism]$ nix-shell -p haskellPackages.ghc --pure [nix-shell:~/programming/ghc-nondeterminism]$ ghc -fforce-recomp -O -j2 -outputdir tmpdir -odir tmpdir -hidir tmpdir -stubdir tmpdir T S && ghc --show-iface tmpdir/T.hi | grep ABI [1 of 2] Compiling S ( S.hs, tmpdir/S.o ) [2 of 2] Compiling T ( T.hs, tmpdir/T.o ) ABI hash: 801be37df642d815fae5f74aa0f56580 [nix-shell:~/programming/ghc-nondeterminism]$ ghc -fforce-recomp -O -j2 -outputdir tmpdir -odir tmpdir -hidir tmpdir -stubdir tmpdir T S && ghc --show-iface tmpdir/T.hi | grep ABI [1 of 2] Compiling S ( S.hs, tmpdir/S.o ) [2 of 2] Compiling T ( T.hs, tmpdir/T.o ) ABI hash: 59cd140ecf48d626231ac3f8ecb5291e [nix-shell:~/programming/ghc-nondeterminism]$ ghc -fforce-recomp -O -j2 -outputdir tmpdir -odir tmpdir -hidir tmpdir -stubdir tmpdir T S && ghc --show-iface tmpdir/T.hi | grep ABI [1 of 2] Compiling S ( S.hs, tmpdir/S.o ) [2 of 2] Compiling T ( T.hs, tmpdir/T.o ) ABI hash: 563ecab71f525a8aea21d4982ec67388 [nix-shell:~/programming/ghc-nondeterminism]$ l total 44K drwxr-xr-x 3 shana nogroup 4.0K Dec 14 19:59 . drwxr-xr-x 221 shana shana 12K Dec 14 19:58 .. -rw-r--r-- 1 shana nogroup 684 Dec 14 19:59 S.hs -rw-r--r-- 1 shana nogroup 18K Dec 14 19:59 T.hs drwxr-xr-x 2 shana nogroup 4.0K Dec 14 20:03 tmpdir }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/4012#comment:70 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC