#4056: GHC panic with small TH code
---------------------------------+------------------------------------------
    Reporter:  verdelyi          |        Owner:                    
        Type:  bug               |       Status:  new               
    Priority:  normal            |    Milestone:                    
   Component:  Template Haskell  |      Version:  6.12.2            
    Keywords:                    |   Difficulty:                    
          Os:  Unknown/Multiple  |     Testcase:                    
Architecture:  Unknown/Multiple  |      Failure:  Compile-time crash
---------------------------------+------------------------------------------
Description changed by igloo:

Old description:

> [verde...@localhost CompilerGenerator-Haskell]$ cat BUG.hs
> {-# LANGUAGE TemplateHaskell, TypeFamilies, RankNTypes, FlexibleContexts
> #-}
>
> import Language.Haskell.TH
>
> astTest :: Q [Dec]
> astTest = [d|
>     generateWalker :: forall t . [t] -> [t]
>     generateWalker = id
>
>     class (Num (From t), Num (To t)) => TransformationPhase t where
>         type From t
>         type To t
>         type Downwards t
>         type Upwards t
>
>         executeTransformationPhase :: [t] -> [t]
>         executeTransformationPhase = undefined
>   |]
> [verde...@localhost CompilerGenerator-Haskell]$ ghci BUG.hs
> GHCi, version 6.12.2: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Loading package ffi-1.0 ... linking ... done.
> [1 of 1] Compiling Main             ( BUG.hs, interpreted )
> ghc: panic! (the 'impossible' happened)
>   (GHC version 6.12.2 for i386-unknown-linux):
>         nameModule executeTransformationPhase{v agj}
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>
> >

New description:

 {{{
 [verde...@localhost CompilerGenerator-Haskell]$ cat BUG.hs
 {-# LANGUAGE TemplateHaskell, TypeFamilies, RankNTypes, FlexibleContexts
 #-}

 import Language.Haskell.TH

 astTest :: Q [Dec]
 astTest = [d|
     generateWalker :: forall t . [t] -> [t]
     generateWalker = id

     class (Num (From t), Num (To t)) => TransformationPhase t where
         type From t
         type To t
         type Downwards t
         type Upwards t

         executeTransformationPhase :: [t] -> [t]
         executeTransformationPhase = undefined
   |]
 [verde...@localhost CompilerGenerator-Haskell]$ ghci BUG.hs
 GHCi, version 6.12.2: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 [1 of 1] Compiling Main             ( BUG.hs, interpreted )
 ghc: panic! (the 'impossible' happened)
   (GHC version 6.12.2 for i386-unknown-linux):
         nameModule executeTransformationPhase{v agj}

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 >
 }}}

--

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