Typechecker loop and stack overflow in 6.4
The following seems to trigger an loop in the typechecker,
which does from stack overflow after a while.
The example is quite pointless but shows
the bug.
newtype PRef a = PRef a
type Drop1 a = a
class Ref a r | a -> r where readRef :: a -> r
instance Ref (PRef a) (Drop1 a) where readRef (PRef v) = v
Here is a dump from the test (bug.hs contains the above code):
e@yui ~/work/pcl/hpclc $ ghci -v -fglasgow-exts bug.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.4, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Using package config file: /usr/lib/ghc-6.4/package.conf
Using package config file: /home/e/.ghc/i386-linux-6.4/package.conf
Hsc static flags: -static
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package base-1.0 ... linking ... done.
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Chasing dependencies:
unload: retaining objs []
unload: retaining bcos []
Stable modules:
unload: retaining objs []
unload: retaining bcos []
*** Compiling Main ( bug.hs, interpreted ):
compile: input file bug.hs
*** Checking old interface for Main:
Compiling Main ( bug.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Exception: stack overflow
Trac metadata
Trac field |
Value |
Version |
None |
Type |
Bug |
TypeOfFailure |
OtherFailure |
Priority |
normal |
Resolution |
ResolvedFixed |
Component |
Compiler (Type checker) |
Test case |
|
Differential revisions |
|
BlockedBy |
|
Related |
|
Blocking |
|
CC |
|
Operating system |
|
Architecture |
|