#1751: program with GADTs segfaults when compiled with -prof and -auto-all
-----------------------+----------------------------------------------------
  Reporter:  guest     |          Owner:         
      Type:  bug       |         Status:  new    
  Priority:  normal    |      Milestone:         
 Component:  Compiler  |        Version:  6.6.1  
  Severity:  normal    |       Keywords:         
Difficulty:  Unknown   |             Os:  Unknown
  Testcase:            |   Architecture:  Unknown
-----------------------+----------------------------------------------------
 Consider the following modules Main.hs and M.hs:

 {{{
 module Main ( main )

 where

 import M

 main :: IO ()
 main = do let f = T [undefined, undefined]
           [a] <- c f (\t -> return [r (UR undefined) t])
           a
 }}}

 {{{
 {-# OPTIONS_GHC -fglasgow-exts -fno-warn-incomplete-patterns #-}
 module M ( R(..), U, r, T(..), c )

 where

 data T f where T :: [T f] -> T ()

 data R t where
     UR  :: (T f -> ()) -> R (U f)
     R :: R ()

 data U f

 c ::  T f -> (T () -> a) -> a
 c p@(T _) f = f p

 r :: R (U f) -> T f -> IO ()
 r a f = (fu a f) `seq` return ()

 fu :: R (U f) -> T f -> ()
 fu (UR f) = f
 }}}

 I get:

 {{{
 $ ghc --make -prof -auto-all Main
 $ ./Main +RTS -p
 Segmentation fault
 $./Main
 Segmentation fault
 }}}

 This is a boiled-down example taken from a large project. A couple of
 observations:

   * I haven't been able to reproduce it using only one module

   * The R constructor from type R is not used, but if removed, the
 segfault no longer happens

   * If -auto-all is not used, the segfault does not happen

   * I've been able to reproduce it both on linux and os x, using ghc 6.6.1

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