Ticket #1751 (closed bug: fixed)
program with GADTs segfaults when compiled with -prof and -auto-all
| Reported by: | guest | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 6.8.1 |
| Component: | Compiler | Version: | 6.6.1 |
| Keywords: | Cc: | jcpetruzza@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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
Change History
Note: See
TracTickets for help on using
tickets.
