#3150: Overlapping data instances can segfault
-------------------------------------+--------------------------------------
 Reporter:  guest                    |          Owner:                  
     Type:  bug                      |         Status:  new             
 Priority:  normal                   |      Milestone:                  
Component:  Compiler (Type checker)  |        Version:  6.10.2          
 Severity:  normal                   |     Resolution:                  
 Keywords:                           |       Testcase:                  
       Os:  Unknown/Multiple         |   Architecture:  Unknown/Multiple
-------------------------------------+--------------------------------------
Changes (by elliottt):

  * version:  6.10.1 => 6.10.2

Comment:

 This data family definition led to the ability to define a generic cast:

 {{{
 {-# LANGUAGE TypeFamilies #-}

 data family T a b t
 data instance T a b t  = L a
 data instance T a b () = R b

 cast :: a -> b
 cast x = let L i = R x in i

 get :: IO Char
 get  = cast ()
 }}}

 This bug was observed in ghc version 6.10.1, 6.10.1.20090326 and 6.10.2.

 {{{
 % ghci test.hs
 GHCi, version 6.10.2: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Main             ( test.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> get
 '\4312564'
 *Main> get
 <interactive>: internal error: stg_ap_v_ret
     (GHC version 6.10.2 for x86_64_unknown_linux)
     Please report this as a GHC bug:
 http://www.haskell.org/ghc/reportabug
 zsh: abort      ghci test.hs
 }}}

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