#5550: GHC infinite loop when compiling vector
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  low               |   Milestone:  7.6.2           
   Component:  Compiler          |     Version:  7.2.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:                    |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by basvandijk):

 My colleague just came to me with the question why his `shell-escape`
 package didn't stop compiling when building with `-O2`. When he mentioned
 he was using `vector` I remembered this bug and after reading through the
 code I noticed he was [https://github.com/solidsnack/shell-
 escape/blob/master/Text/ShellEscape/EscapeVector.hs#L34 using foldl'].

 Roman, can we identify which uses of `foldl'` result in infinite
 compilation times? If so, a note about this should probably be added to
 the documentation to warn users not to use this function since GHC will
 crash on it.

 Here are just some quick experiments to see when GHC crashes:

 {{{
 ok1 = let f x y = x+y
           z = 0
       in V.foldl' f z

 ok2 = let f (i,j) y = (i+y, j+y)
           z = (0,0)
       in V.foldl' f z

 ok3 = let f Nothing y = Just y
           f (Just x) y = Just (x+y)
           z = Nothing
       in V.foldl' f z

 crash1 = let f x y = y:x
              z = []
          in V.foldl' f z

 crash2 = let f (i,j) y = (y:i, j+y)
              z = ([],0)
          in V.foldl' f z
 }}}

 It seems that uses of a list anywhere in the accumulator result in
 crashes. But this probably also happens on other types.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5550#comment:22>
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