
From the known bugs (http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc): """GHC's inliner can be persuaded into non-termination using the standard way to encode recursion via a data type... We have never found another class of programs, other than this contrived one, that makes GHC diverge, and fixing the problem would impose an extra overhead on every compilation. So the bug remains un-fixed."""
There are now three more examples, at least two of which weren't 'contrived': http://hackage.haskell.org/trac/ghc/ticket/5448 http://hackage.haskell.org/trac/ghc/ticket/5400 http://hackage.haskell.org/trac/ghc/ticket/3872 It took me about 4-6 hours to track down this bug in my own code (#5448) since it required repeatedly bisecting a larger program until I had a small testcase. In the test program, I can get around it with {-# NOINLINE funcEq #-}. In the program it came from, though, FuncEq is an imported value, so I have to either compile with -O0, or change put the pragma in the imported library, where it will effect a fair amount of code that /doesn't/ hit this bug. If adding the check is too expensive, can the inliner have a configurable recursion bount (ala -fcontext-stack)? -Ron Alford

On Tue, Sep 6, 2011 at 3:33 PM, Ron Alford
It took me about 4-6 hours to track down this bug in my own code (#5448) since it required repeatedly bisecting a larger program until I had a small testcase. In the test program, I can get around it with {-# NOINLINE funcEq #-}. In the program it came from, though, FuncEq is an imported value, so I have to either compile with -O0, or change put the pragma in the imported library, where it will effect a fair amount of code that /doesn't/ hit this bug.
This doesn't solve GHC's bug, but can you do something like myFuncEq = funcEq {-# NOINLINE myFuncEq #-} and just use myFuncEq everywhere? This should make the change local to your module. Cheers, -- Felipe.

On Tue, Sep 6, 2011 at 7:50 PM, Felipe Almeida Lessa
This doesn't solve GHC's bug, but can you do something like
myFuncEq = funcEq {-# NOINLINE myFuncEq #-}
and just use myFuncEq everywhere? This should make the change local to your module.
Unfortunately not. The only time I use funcEq in the code in question is the instance declaration. -Ron Alford
participants (2)
-
Felipe Almeida Lessa
-
Ron Alford