Thanks -- fixed.

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Wolfgang
| Thaller
| Sent: 09 November 2004 04:12
| To: [EMAIL PROTECTED]
| Subject: Compiler Panic caused by typechecker
| 
| This is with a recent HEAD build.
| 
| {-# OPTIONS -fglasgow-exts #-}
| module Bug where
| import GHC.Base
| 
| foo = let I# x# = 7 * 7 in "Forty-Two"
| 
| ====
| 
| ghc --make Bug.hs  -dcore-lint
| Chasing modules from: IntInstBug.hs
| Compiling Bug              ( IntInstBug.hs, IntInstBug.o )
| *** Core Lint Errors: in result of Desugar ***
| <no location info>:
|      In the expression: * lit_a1fh
|      lit_a1fh is out of scope
| *** Offending Program ***
| Rec {
| $dNum :: {GHC.Num.Num GHC.Base.Int}
| $dNum = GHC.Num.$fNumInt
| * :: GHC.Base.Int -> GHC.Base.Int -> GHC.Base.Int
| * = GHC.Num.* @ GHC.Base.Int $dNum
| lit_a1dZ :: GHC.Base.Int
| lit_a1dZ = GHC.Base.I# 7
| foo :: [GHC.Base.Char]
| foo = let {
|          ds_d1fg :: GHC.Base.Int
|          ds_d1fg = * lit_a1fh lit_a1dZ
|        } in
|          case ([GHC.Base.Char]) ds_d1fg of wild_B1 { GHC.Base.I# x# ->
|          let {
|            x# :: GHC.Prim.Int#
|            x# = x# } in
|          __letrec { } in  __letrec { } in  GHC.Base.unpackCString#
| "Forty-Two"
|          }
| Bug.foo :: [GHC.Base.Char]
| [Exported]
| Bug.foo = foo
| end Rec }
| 
| *** End of Offense ***
| 
| 
| Compilation had errors
| 
| ===
| 
| The key here is the double use of an overloaded Int literal. The two
| LitInsts for the two literals compare as equal, so one is dropped. The
| code still refers to both names, though.
| It can be fixed by taking the Names into account when comparing
| LitInsts; I have no idea whether this is the best/right way to do it,
| but it seems to work.
| 
| Cheers,
| 
| Wolfgang
| 
| === patch follows ===
| 
| Index: ghc/compiler/typecheck/TcRnTypes.lhs
| ===============================================================
| ====
| RCS file:
/home/cvs/root/fptools/ghc/compiler/typecheck/TcRnTypes.lhs,v
| retrieving revision 1.43
| diff -u -r1.43 TcRnTypes.lhs
| --- ghc/compiler/typecheck/TcRnTypes.lhs      8 Oct 2004 13:58:56
-0000   1.43
| +++ ghc/compiler/typecheck/TcRnTypes.lhs      9 Nov 2004 03:10:50
-0000
| @@ -699,7 +699,7 @@
| 
|   cmpInst (LitInst _ _ _ _)     (Dict _ _ _)              = GT
|   cmpInst (LitInst _ _ _ _)     (Method _ _ _ _ _ _)      = GT
| -cmpInst (LitInst _ lit1 ty1 _)         (LitInst _ lit2 ty2 _)    =
(lit1
| `compare` lit2) `thenCmp` (ty1 `tcCmpType` ty2)
| +cmpInst (LitInst name1 lit1 ty1 _)     (LitInst name2 lit2 ty2 _)
=
| (lit1 `compare` lit2) `thenCmp` (ty1 `tcCmpType` ty2) `thenCmp` (name1
| `compare` name2)
|   \end{code}
| 
| 
| _______________________________________________
| Cvs-ghc mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/cvs-ghc
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to