#2799: Panic (core lint failure) with GADTs, GHC 6.10.1
-------------------------+--------------------------------------------------
    Reporter:  alexey_r  |       Owner:          
        Type:  bug       |      Status:  new     
    Priority:  normal    |   Component:  Compiler
     Version:  6.10.1    |    Severity:  major   
    Keywords:            |    Testcase:          
Architecture:  x86       |          Os:  Windows 
-------------------------+--------------------------------------------------
 The compiler panic when trying to compile
 [http://www.seas.upenn.edu/~sweirich/RepLib/ RepLib 0.2].

 A stripped-down example:
 {{{
 {-# OPTIONS -fglasgow-exts -XUndecidableInstances #-}

 module RepAux (
   toSpineRl
 ) where

 data R a = R

 data Nil = Nil
 data a :*: l = a :*: l

 data MTup r l where
     MNil   :: MTup ctx Nil
     (:+:)  :: r a -> MTup r l -> MTup r (a :*: l)

 data Typed a = a ::: R a

 data Spine a where
          (:<>)  :: Spine (a -> b) -> Typed a -> Spine b

 toSpineRl :: MTup R l -> l -> (l -> a) -> Spine a
 toSpineRl MNil Nil into = undefined
 toSpineRl (ra :+: rs) (a :*: l) into =
          (toSpineRl rs l into') :<> (a ::: ra)
                   where into' tl1 x1 = into (x1 :*: tl1)
 }}}

 Compiler panic:
 {{{
 F:\Programming\Libraries\Haskell\replib-bug>ghc --make RepAux
 [1 of 1] Compiling RepAux           ( RepAux.hs, RepAux.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 6.10.1 for i386-unknown-mingw32):
         initC: srt_lbl

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

 With -v:
 {{{
 F:\Programming\Libraries\Haskell\replib-bug>ghc --make RepAux -v
 Glasgow Haskell Compiler, Version 6.10.1, for Haskell 98, stage 2 booted
 by GHC
 version 6.8.3
 Using package config file: F:\proglangs\ghc\ghc-6.10.1\package.conf
 hiding package base-3.0.3.0 to avoid conflict with later version
 base-4.0.0.0
 hiding package regex-base-0.72.0.2 to avoid conflict with later version
 regex-ba
 se-0.93.1
 hiding package parsec-2.1.0.1 to avoid conflict with later version
 parsec-3.0.0
 hiding package QuickCheck-1.2.0.0 to avoid conflict with later version
 QuickChec
 k-2.1
 hiding package QuickCheck-2.1 to avoid conflict with later version
 QuickCheck-2.
 1.0.1
 hiding package rmonad-0.2 to avoid conflict with later version rmonad-0.3
 hiding package TypeCompose-0.5.1 to avoid conflict with later version
 TypeCompos
 e-0.6.0
 hiding package reactive-0.9.0 to avoid conflict with later version
 reactive-0.9.
 1
 wired-in package ghc-prim mapped to ghc-prim-0.1.0.0
 wired-in package integer mapped to integer-0.1.0.0
 wired-in package base mapped to base-4.0.0.0
 wired-in package rts mapped to rts-1.0
 wired-in package haskell98 mapped to haskell98-1.0.1.0
 wired-in package syb mapped to syb-0.1.0.0
 wired-in package template-haskell mapped to template-haskell-2.3.0.0
 wired-in package dph-seq mapped to dph-seq-0.3
 wired-in package dph-par mapped to dph-par-0.3
 Hsc static flags: -static
 *** Chasing dependencies:
 Chasing modules from: *RepAux.hs
 Stable obj: []
 Stable BCO: []
 Ready for upsweep
   [NONREC
       ModSummary {
          ms_hs_date = Sat Nov 22 20:43:55 Russian Standard Time 2008
          ms_mod = main:RepAux,
          ms_imps = []
          ms_srcimps = []
       }]
 compile: input file RepAux.hs
 Created temporary directory:
 C:\Users\Alexey\AppData\Local\Temp\/ghc12212_0
 *** Checking old interface for main:RepAux:
 [1 of 1] Compiling RepAux           ( RepAux.hs, RepAux.o )
 *** Parser:
 *** Renamer/typechecker:
 *** Desugar:
     Result size = 74
 *** Simplify:
     Result size = 65
     Result size = 65
 *** Tidy Core:
     Result size = 65
 *** CorePrep:
     Result size = 119
 *** Stg2Stg:
 *** CodeGen:
 *** CodeOutput:
 *** Deleting temp files:
 Deleting: C:\Users\Alexey\AppData\Local\Temp\/ghc12212_0/ghc12212_0.s
 Warning: exception raised when deleting
 C:\Users\Alexey\AppData\Local\Temp\/ghc1
 2212_0/ghc12212_0.s:
 DeleteFile: permission denied (The process cannot access the file because
 it is
 being used by another process.)
 *** Deleting temp dirs:
 Deleting: C:\Users\Alexey\AppData\Local\Temp\/ghc12212_0
 Warning: exception raised when deleting
 C:\Users\Alexey\AppData\Local\Temp\/ghc1
 2212_0:
 RemoveDirectory: unsatisified constraints (The directory is not empty.)
 ghc: panic! (the 'impossible' happened)
   (GHC version 6.10.1 for i386-unknown-mingw32):
         initC: srt_lbl

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

 With -dcore-lint:
 {{{
 F:\Programming\Libraries\Haskell\replib-bug>ghc --make RepAux -dcore-lint
 [1 of 1] Compiling RepAux           ( RepAux.hs, RepAux.o )
 *** Core Lint Errors: in result of Desugar ***
 {-# LINE 24 "RepAux.hs #-}:
     [RHS of into'_ahT :: l_ahu -> a_aht -> a_ahe]
     into'_agp is out of scope
 *** Offending Program ***
 Rec {
 RepAux.toSpineRl :: forall l_ag8 a_ag9.
                     RepAux.MTup RepAux.R l_ag8
                     -> l_ag8
                     -> (l_ag8 -> a_ag9)
                     -> RepAux.Spine a_ag9
 [Exported]
 []
 RepAux.toSpineRl =
   \ (@ l_ahd) (@ a_ahe) ->
     let {
       toSpineRl_ahf :: RepAux.MTup RepAux.R l_ahd
                        -> l_ahd
                        -> (l_ahd -> a_ahe)
                        -> RepAux.Spine a_ahe
       []
       toSpineRl_ahf = RepAux.toSpineRl @ l_ahd @ a_ahe } in
     \ (ds_dia :: RepAux.MTup RepAux.R l_ahd)
       (ds_dib :: l_ahd)
       (into_agc :: l_ahd -> a_ahe) ->
       case ds_dia of wild_B1 {
         RepAux.MNil @ $co$_ahn ->
           letrec { } in
           let {
             ds_did :: RepAux.Nil
             []
             ds_did =
               ds_dib
               `cast` (sym
                         (trans
                            (trans RepAux.Nil (sym (trans $co$_ahn (sym
 RepAux.Ni
 l)))) l_ahd)
                       :: l_ahd ~ RepAux.Nil) } in
           case ds_did of wild_B1 { RepAux.Nil ->
           letrec { } in GHC.Err.undefined @ (RepAux.Spine a_ahe)
           };
         RepAux.:+: @ a_aht @ l_ahu @ $co$_ahU ra_agf rs_agh ->
           letrec {
             into'_ahT :: l_ahu -> a_aht -> a_ahe
             []
             into'_ahT =
               into'_agp
                 @ a_aht
                 @ l_ahu
                 @ (trans
                      (trans
                         (a_aht RepAux.:*: l_ahu)
                         (sym (trans $co$_ahU (sym (a_aht RepAux.:*:
 l_ahu)))))
                      l_ahd); } in
           let {
             ds_dic :: a_aht RepAux.:*: l_ahu
             []
             ds_dic =
               ds_dib
               `cast` (sym
                         (trans
                            (trans
                               (a_aht RepAux.:*: l_ahu)
                               (sym (trans $co$_ahU (sym (a_aht RepAux.:*:
 l_ahu)
 ))))
                            l_ahd)
                       :: l_ahd ~ a_aht RepAux.:*: l_ahu) } in
           case ds_dic of wild_B1 { RepAux.:*: a_agj l_agl ->
           letrec { } in
           let {
             into_agn :: l_ahd -> a_ahe
             []
             into_agn = into_agc } in
           letrec {
             into'_agp :: forall a_ahH l_ahI.
                          (a_ahH RepAux.:*: l_ahI ~ l_ahd) =>
                          l_ahI -> a_ahH -> a_ahe
             []
             into'_agp =
               \ (@ a_ahH) (@ l_ahI) (@ co_ahK) ->
                 letrec {
                   into'_ahM :: l_ahI -> a_ahH -> a_ahe
                   []
                   into'_ahM =
                     \ (tl1_ags :: l_ahI) (x1_agu :: a_ahH) ->
                       into_agn
                         ((\ (sub_ai7 :: a_ahH) (sub_ai8 :: l_ahI) ->
                             (RepAux.:*: @ a_ahH @ l_ahI sub_ai7 sub_ai8)
                             `cast` (trans
                                       (trans (a_ahH RepAux.:*: l_ahI) (sym
 (sym
 co_ahK))) l_ahd
                                     :: a_ahH RepAux.:*: l_ahI ~ l_ahd))
                            x1_agu tl1_ags); } in
                 into'_ahM; } in
           RepAux.:<>
             @ a_ahe
             @ a_aht
             (RepAux.toSpineRl
                @ l_ahu @ (a_aht -> a_ahe) rs_agh l_agl into'_ahT)
             (RepAux.::: @ a_aht a_agj ra_agf)
           }
       }
 end Rec }

 *** End of Offense ***


 <no location info>:
 Compilation had errors
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2799>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to