Ticket #1751 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

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

Changed 6 years ago by sorear

Thanks for the report.

I can reproduce this with 6.6.1 and 6.7.20070223, but not with 6.7.20070323 or any later version (fail with error: Prelude.undefined).

I don't see any patches containing the word 'crash' or 'prof' in that span, though.

Changed 6 years ago by simonpj

  • priority changed from normal to low
  • milestone set to 6.6.2

I've just tried this again and it seems to work fine with the 6.8 branch and with the HEAD. Rather than chase further, I'm going to downgrade this to 'low', with the intention of not looking at it further unless it crops up again. It'd be nicer to chase down exactly where the seg-fault occurs, but life is too short!

It might be worth revisiting if we ever released 6.6.2 (which we don't currently plan to).

Simon

Changed 6 years ago by simonmar

  • status changed from new to closed
  • resolution set to fixed

We won't be doing 6.6.2.

Changed 6 years ago by simonmar

  • milestone changed from 6.6.2 to 6.8.1

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.