Opened 10 years ago

Closed 10 years ago

Last modified 46 years ago

#405 closed bug (Fixed)

Typechecker loop and stack overflow in 6.4

Reported by: ekarttun Owned by: nobody
Priority: normal Milestone:
Component: Compiler (Type checker) Version: None
Keywords: Cc:
Operating System: Architecture:
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

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

Change History (2)

comment:1 Changed 10 years ago by simonpj

Logged In: YES 
user_id=50165

Excellent point.  Now fixed.

tc195.hs tests this case.

Thank you for the report

comment:2 Changed 10 years ago by simonpj

  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.