#13031: Bogus calculation of bottoming arity -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In `CoreArity` we see {{{ andArityType (ABot n1) (ABot n2) = ABot (n1 `min` n2) }}} If you look at the documentation for `ABot` (which is about functions that are ''guaranteed'' to diverge) this is obviously bogus. The `min` should be `max`! Here's a test case: {{{ {-# LANGUAGE MagicHash #-} module Foo( f ) where import GHC.Prim f True = raise# True f False = \p q -> raise# False }}} If you compile (with GHC 8.0) `-ddump-simpl` you'll see {{{ f :: forall a p1 p2. Bool -> p2 -> p1 -> a [GblId, Arity=1, Caf=NoCafRefs, Str=<L,U>x] }}} That `Str=<L,U>x` is totally bogus; it claims that `f` will always diverge given one argument. The fix is easy. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13031> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler