[GHC] #7364: `foo !f = id . f` becomes non-strict with -O2
GHC
cvs-ghc at haskell.org
Wed Oct 24 03:55:20 CEST 2012
#7364: `foo !f = id . f` becomes non-strict with -O2
-----------------------------------------+----------------------------------
Reporter: shachaf | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.6.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Incorrect result at runtime | Testcase:
Blockedby: | Blocking:
Related: |
-----------------------------------------+----------------------------------
The following program:
{{{
foo :: (a -> b) -> a -> b
foo !f = id . f
main :: IO ()
main = print (foo undefined `seq` "ok")
}}}
Crashes with `Prelude.undefined` when compiled without `-O2`, but prints
`"ok"` with it. As far as I can tell the optimizer shouldn't be allowed to
do that.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7364>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list