#5671: ghc-7.2 vector code segfaults
-------------------------------+--------------------------------------------
    Reporter:  kosmikus        |       Owner:               
        Type:  bug             |      Status:  new          
    Priority:  normal          |   Component:  Compiler     
     Version:  7.2.1           |    Keywords:               
    Testcase:                  |   Blockedby:               
          Os:  Linux           |    Blocking:               
Architecture:  x86_64 (amd64)  |     Failure:  Runtime crash
-------------------------------+--------------------------------------------
 The following program segfaults on x86_64 with vector-0.9

   * with ghc-7.2.1 and -O
   * with ghc-7.2.2 and -O
   * with ghc-7.3.20111122 and -O

 I does ''not'' segfault with ghc-7.0.4 or without -O.

 It also segfaults on x86 if I change the number from 965 to 1934. I
 haven't thoroughly tested this, but these seem to be the smallest numbers
 each for which there is a segfault.

 {{{

 import qualified Data.Vector as U

 main :: IO ()
 main =
   f (U.fromList (replicate 965 (((), ()), ())))
   `seq` return ()

 f x = g (fst (U.unzip x))

 g x = U.zipWith (flip const) x (h (fst (U.unzip x)))

 h x = U.zipWith op y x
   where y = U.zipWith op x (U.init z)
         z = U.generate (n+1) (\ i -> x U.! (if i >= n then n - 1 else i))
         n = U.length x

 op () () = ()
 }}}

 By looking at Core code a bit and comparing output from 7.0.4 and 7.2.2, I
 see reversed array indexing and bounds checking. So it looks like this
 might be related to bug #5658, but I'm not sure.

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