[GHC] #15225: `-fno-state-hack` produces incorrect results in nofib
GHC
ghc-devs at haskell.org
Mon Jun 4 14:59:58 UTC 2018
#15225: `-fno-state-hack` produces incorrect results in nofib
-------------------------------------+-------------------------------------
Reporter: tdammers | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.5
Keywords: | Operating System: Linux
Architecture: x86_64 | Type of failure: Incorrect result
(amd64) | at runtime
Test Case: | Blocked By:
Blocking: | Related Tickets: #7411
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
While investigating #7411, I found that nofib fails with incorrect output
from the `fasta` test.
A vanilla `prof` build behaves normally; however, with the following
modifications, `nofib` fails:
- Compile GHC from scratch with:
{{{
GhcStage2HcOpts = -O -fno-state-hack
GhcLibHcOpts = -O -fno-state-hack
}}}
- Run nofib with `EXTRA_HC_OPTS=-fno-state-hack`
Doing this, the nofib test output is:
{{{
------------------------------------------------------------------------
== make all --no-print-directory;
in /home/tobias/well-typed/devel/ghc/HEAD/nofib/shootout/fasta
------------------------------------------------------------------------
HC = /home/tobias/well-typed/devel/ghc/HEAD/inplace/bin/ghc-stage2
HC_OPTS = -O2 -Rghc-timing -H32m -hisuf hi -fno-state-hack -O2 -rtsopts
-O2 -XBangPatterns -XOverloadedStrings -package bytestring
RUNTEST_OPTS = -ghc-timing
==nofib== fasta: time to compile Main follows...
/home/tobias/well-typed/devel/ghc/HEAD/inplace/bin/ghc-stage2 -O2 -Rghc-
timing -H32m -hisuf hi -fno-state-hack -O2 -rtsopts -O2 -XBangPatterns
-XOverloadedStrings -package bytestring -c Main.hs -o Main.o
Main.hs:30:1: warning: [-Wtabs]
Tab character found here, and in 13 further locations.
Please use spaces instead.
|
30 | let !k = min modulus (floor (fromIntegral modulus *
(p::Float) + 1))
| ^^^^^^^^
<<ghc: 401958512 bytes, 72 GCs, 10720054/28796976 avg/max bytes residency
(6 samples), 61M in use, 0.001 INIT (0.001 elapsed), 0.342 MUT (0.420
elapsed), 0.240 GC (0.238 elapsed) :ghc>>
==nofib== fasta: size of Main.o follows...
text data bss dec hex filename
7245 2624 0 9869 268d Main.o
==nofib== fasta: time to link fasta follows...
<<ghc: 49626024 bytes, 45 GCs, 1356153/2672728 avg/max bytes residency (5
samples), 8M in use, 0.001 INIT (0.001 elapsed), 0.025 MUT (0.468
elapsed), 0.060 GC (0.060 elapsed) :ghc>>
==nofib== fasta: size of fasta follows...
text data bss dec hex filename
708996 127712 16232 852940 d03cc fasta
==nofib== fasta: time to run fasta follows...
../../runstdtest/runstdtest ./fasta -o1 fasta.stdout -o1 fasta.stdout
-ghc-timing 2500000; ../../runstdtest/runstdtest ./fasta -o1
fasta.stdout -o1 fasta.stdout -ghc-timing 2500000;
../../runstdtest/runstdtest ./fasta -o1 fasta.stdout -o1 fasta.stdout
-ghc-timing 2500000; ../../runstdtest/runstdtest ./fasta -o1
fasta.stdout -o1 fasta.stdout -ghc-timing 2500000;
../../runstdtest/runstdtest ./fasta -o1 fasta.stdout -o1 fasta.stdout
-ghc-timing 2500000;
0.43user 0.02system 0:00.45elapsed 99%CPU (0avgtext+0avgdata
4824maxresident)k
0inputs+49656outputs (0major+608minor)pagefaults 0swaps
././fasta 2500000 < /dev/null
expected stdout not matched by reality
--- fasta.stdout 2018-06-02 03:00:43.887025433 +0200
+++ /tmp/runtest4673.1 2018-06-02 03:09:19.651755697 +0200
@@ -83337,333335 +83337,333335 @@
cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
-tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
-NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt
-cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga
-gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa
-HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca
#### ~3.1 million similar lines follow ####
-taatataagctgcgccaggggatttttccagatcatctggcctgtgtatatgttcaaatc
+gacgaatatattagttatagtttactatccaaataaattaagcgaatcgaaataaactgt
+gacgaatatattagttatagtttactatccaaataaattaagcgaatcgaaataaactgt
+gacgaatatattagttatagtttactatccaaataaattaagcgaatcgaaataaactgt
#### ~208k identical lines follow
+gacgaatatattagttatagtttactatccaaataaattaagcgaatcgaaataaactgt
taatagccgagagaaattac
../../mk/target.mk:101: recipe for target 'runtests' failed
make[2]: *** [runtests] Error 1
Failed making all in fasta: 1
../mk/ghc-recurse.mk:65: recipe for target 'all' failed
make[1]: *** [all] Error 1
Failed making all in shootout: 1
mk/ghc-recurse.mk:65: recipe for target 'all' failed
make: *** [all] Error 1
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15225>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list