Infinite loop when printing error message
I am trying to compile a file that has a known compile error. Ghc gets into an infinite loop trying to output the error message.
Here's the session (captured using EMACS shell):
pberry@Dal:~/bridge_ghc_bug$ uname -a
Linux Dal 2.6.18-3-686 #1 SMP Mon Dec 4 16:41:14 UTC 2006 i686 GNU/Linux
pberry@Dal:~/bridge_ghc_bug$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
pberry@Dal:~/bridge_ghc_bug$ ghc -v --make main.hs
Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC version 6.6
Using package config file: /usr/lib/ghc-6.6/package.conf
wired-in package base mapped to base-2.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.0
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: main.hs
Stable obj: []
Stable BCO: []
compile: input file main.hs
Created temporary directory: /tmp/ghc5182_0
*** Checking old interface for main:Main:
[1 of 1] Compiling Main ( main.hs, main.o )
*** Parser:
*** Renamer/typechecker:
main.hs:30:12:
No instance for (Show Rank)
arising from use of `show' at main.hs:30:12-19
Possible fix: add an instance declaration for (Show Rank)
In the first argument of `(~?=)', namely `show Ten'
In the expression: (show Ten) ~?= "T"
In the second argument of `($)', namely
`[(show Two) ~?= "2", (show Three) ~?= "3", (show Four) ~?= "4",
(show Five) ~?= "5", (show Six) ~?= "6", (show Seven) ~?= "7",
(show Eight) ~?= "8", (show Nine) ~?= "9", (show Ten) ~?= "T",
At this point ghc goes into an (apparently) infinite loop outputting spaces. When I interrupt it using Ctrl-C, it says:
*** Deleting temp files:
Deleting: /tmp/ghc5182_0/ghc5182_0.s
Warning: deleting non-existent /tmp/ghc5182_0/ghc5182_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc5182_0
Here's the file main.hs:
import System
import Test.HUnit
import Control.Monad
import Data.List
data Card = Card Rank Suit
data Suit = Clubs | Diamonds | Hearts | Spades
deriving (Enum, Eq)
data Rank = Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace
deriving (Enum, Ord, Eq)
type Hand = [Card]
hand :: String -> Hand
hand = undefined
main = undefined
allTests = test $
[show Two ~?= "2"
,show Three ~?= "3"
,show Four ~?= "4"
,show Five ~?= "5"
,show Six ~?= "6"
,show Seven ~?= "7"
,show Eight ~?= "8"
,show Nine ~?= "9"
,show Ten ~?= "T"
,hand "AK76543/32/AK2/3" ~?= exampleHand
]
where exampleHand = []
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Linux |
Architecture | x86 |