
#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))
| ^^^^^^^^
<