id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
5400	GHC loops on compiling with optimizations	noschinl		"When compiling the snippet below with optimizations enabled (i.e. `ghc -O test.hs`), GHC does not seem to terminate. This happens with at least 7.0.3 and 7.0.4. Without optimizations, it builds fine.

{{{
data A = A Int

class C a where 
    fromHsk :: C a => a -> Int

instance C Int where 
    fromHsk = fromHsk

instance C A where 
    fromHsk (A s) = fromHsk s

main = undefined

}}}

When building this example with GHC 6.12.4, it fails with a complaint about the bogus type constraints in the declaration of fromHsk:

{{{
test.hs:3:0:
    All of the type variables in the constraint `C a'
    are already in scope (at least one must be universally quantified here)
        (Use -XFlexibleContexts to lift this restriction)
    When checking the class method: fromHsk :: (C a) => a -> Int
    In the class declaration for `C'
}}}

After removing these unneeded constraint (i.e. changing the declaration of `fromHsk` to `fromHsk :: a -> Int`, the snippet above builds even with GHC 7.0.4 and optimizations."	bug	new	normal	_|_	Compiler	7.0.4				Linux	x86_64 (amd64)	Compile-time crash					
