#5658: Strict bindings are wrongly floated out of case alternatives.
---------------------------------+------------------------------------------
    Reporter:  benl              |       Owner:  benl            
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:  7.4.1           
   Component:  Compiler          |     Version:  7.2.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  Runtime crash   
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by rl):

 As requested, here is a small program that demonstrated this. Note the
 difference between 7.2 and 7.4 when compiling with -O2.

 {{{
 {-# LANGUAGE MagicHash, BangPatterns #-}
 module T where
 import GHC.Prim

 foo :: ByteArray# -> ByteArray# -> Int# -> Int# -> Bool
 foo xs ys m n = go 0# 0#
   where
     go i j = case i >=# m of
       False -> let !x = indexIntArray# xs i in
         case j >=# n of
           False -> case x ==# indexIntArray# ys j of
             False -> False
             True  -> go (i +# 1#) (j +# 1#)
           True -> False
       True -> case j >=# n of
         False -> let !y = indexIntArray# ys i in False
         True -> True
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to