[GHC] #9235: Simplifier ticks exhausted on recursive class method

#9235: Simplifier ticks exhausted on recursive class method -----------------------------------+--------------------------------------- Reporter: klao | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time crash Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -----------------------------------+--------------------------------------- GHC 7.8 and HEAD panic on the following code: {{{#!haskell module C where class C a where c :: C a => a -> Int c a = c a {-# INLINE c #-} instance C () x :: Int x = c () }}} Note that it's the coincidence of the 3 conditions that triggers this bug: 1. the `c` method has to be inlined (explicity or implicitly) 2. it has to be recursive (but, it doesn't have to be as dumbly recursive as in the example) 3. it has to have this weird, slightly mistaken type signature: `C a => a -> Int` instead of simply `a -> Int`. But, when this incidentally happens (in my case, both 2. ''and'' 3. were unintentional), the user gets a very hard to debug issue. They don't even get an indication which module is responsible if `c` is used from a different module than the one with the class definition. Also note that this happens even with a non-optimized build. And in this example `c` has to be explicitly marked NOINLINE to prevent it. (In the instance that I caught in the wild simply removing the INLINE annotation was enough.) Finally, on a side note: shouldn't 3. by itself be an error? Or a warning at least? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9235 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9235: Simplifier ticks exhausted on recursive class method ---------------------------------------+----------------------------------- Reporter: klao | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by simonpj): This is a dup of #5722, but I'm going to leave it open as evidence that someone else has tripped up over it. The weird type signature is a special case of something that is generally allowed. I don't in general know how to stop it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9235#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9235: Simplifier ticks exhausted on recursive class method -------------------------------------+------------------------------------- Reporter: klao | Owner: Type: bug | Status: new Priority: normal | Milestone: ⊥ Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * milestone: => ⊥ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9235#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC