#5400: GHC loops on compiling with optimizations
-------------------------------+--------------------------------------------
    Reporter:  noschinl        |       Owner:                    
        Type:  bug             |      Status:  new               
    Priority:  normal          |   Component:  Compiler          
     Version:  7.0.4           |    Keywords:                    
    Testcase:                  |   Blockedby:                    
          Os:  Linux           |    Blocking:                    
Architecture:  x86_64 (amd64)  |     Failure:  Compile-time crash
-------------------------------+--------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5400>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to