
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