[GHC] #5129: "evaluate" optimized away

GHC cvs-ghc at haskell.org
Wed May 4 02:13:04 CEST 2011


#5129: "evaluate" optimized away
---------------------------------+------------------------------------------
    Reporter:  dons              |        Owner:  simonmar                   
        Type:  bug               |       Status:  new                        
    Priority:  normal            |    Milestone:                             
   Component:  Compiler          |      Version:  7.0.3                      
    Keywords:  seq, evaluate     |     Testcase:                             
   Blockedby:                    |   Difficulty:                             
          Os:  Unknown/Multiple  |     Blocking:                             
Architecture:  Unknown/Multiple  |      Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------

Comment(by ezyang):

 One rather user-visible result of this ticket is that we should now
 discourage the use of the idiom

 {{{
 x `seq` return ()
 }}}

 I can see a few instances of this in `base`

 {{{
 ezyang at javelin:~/Dev/ghc-master/libraries/base$ grep -R '`seq` return ()'
 .
 ./Foreign/C/String.hs:        go [] n     = n `seq` return () -- make it
 strict in n
 ./Foreign/C/String.hs:        go [] n     = n `seq` return () -- make it
 strict in n
 ./GHC/IO/Handle/Text.hs:    c `seq` return ()
 ./GHC/Conc/Windows.hs:  r `seq` return () -- avoid space leak
 }}}

 and there are probably more elsewhere.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5129#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list