#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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to