[GHC] #12656: ghc floats out constant despite -fno-cse
GHC
ghc-devs at haskell.org
Mon Oct 3 15:07:32 UTC 2016
#12656: ghc floats out constant despite -fno-cse
-------------------------------------+-------------------------------------
Reporter: nh2 | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by bitonic):
Actually I spoke too soon: this doesn't work even with `NOINLINE`!
{{{
$ cat weird-float.hs
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
main :: IO ()
main = do
foo 100000
foo 100000
let f = foo 100000 in f >> f
{-# NOINLINE foo #-}
foo :: Int -> IO ()
foo n = do
indexVector <- V.unsafeThaw $ V.generate n id
x <- VM.read indexVector 5
VM.write indexVector 5 (x * x)
print x
$ stack exec --resolver lts-7 --package vector -- ghc -fforce-recomp
-package vector -O0 -fno-full-laziness -fno-cse weird-float.hs -o weird-
float-lts-7
Run from outside a project, using implicit global project config
Using resolver: lts-7 specified on command line
Selected resolver: lts-7.2
[1 of 1] Compiling Main ( weird-float.hs, weird-float.o )
Linking weird-float-lts-7 ...
$ ./weird-float-lts-7
5
5
5
25
$ stack exec --resolver lts-7 --package vector -- ghc --version
Run from outside a project, using implicit global project config
Using resolver: lts-7 specified on command line
Selected resolver: lts-7.2
The Glorious Glasgow Haskell Compilation System, version 8.0.1
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12656#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list