#5884: GHC panics while trying to derive a Generic instance for Complex a
---------------------------------+------------------------------------------
    Reporter:  mux               |       Owner:  dreixel           
        Type:  bug               |      Status:  new               
    Priority:  normal            |   Milestone:                    
   Component:  Compiler          |     Version:  7.4.1             
    Keywords:                    |          Os:  Unknown/Multiple  
Architecture:  Unknown/Multiple  |     Failure:  Compile-time crash
  Difficulty:  Unknown           |    Testcase:                    
   Blockedby:                    |    Blocking:                    
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by guest):

 I just ran into the same issue.  The following conditions are required to
 reproduce:

   - the type we are trying to derive must be defined in a different module
   - that module must be compiled, not interpreted
   - the type we are trying to derive must have at least one non-phantom
 type variable argument

 In short if we define these types in a module:
 {{{
 data A = A Int
 data X a = X Int
 data Y a = Y a
 }}}
 Compile this module and then import it into another module and derive some
 instances:
 {{{
 deriving instance Generic A   -- works
 deriving instance Generic (X a)   -- works
 deriving instance Generic a => Generic (X a) -- works
 deriving instance Generic a => Generic (Y a) -- panic
 deriving instance Generic (Y a) -- panic

 data Z a = Z a
 deriving instance Generic a => Generic (Z a) -- works
 deriving instance Generic (Z a) -- works
 }}}

 I created a custom GHC API client to get a backtrace from the panic, but
 that doesn't seem particularly helpful:
 {{{
 *** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace:
   TcInteract.solve_loop,
   called from TcInteract.solveInteract,
   called from TcRnDriver.simplifyTop,
   called from TcRnDriver.tcRnSrcDecls,
   called from HscMain.Typecheck-Rename,
   called from Main.main,
   called from Main.CAF
 Segmentation fault
 }}}

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