[GHC] #13031: Bogus calculation of bottoming arity
#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
#13031: Bogus calculation of bottoming arity -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"f06b71ae2e76ec81a618bc8bb0409b3fc6a7ebbe/ghc" f06b71a/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="f06b71ae2e76ec81a618bc8bb0409b3fc6a7ebbe" Fix a bug in ABot handling in CoreArity See Note [ABot branches: use max] in CoreArity. I stumbled on this when investigating something else, and opened Trac #13031 to track it. It's very hard to tickle the bug, which is why it has lurked so long, but the test stranal/should_compile/T13031 does so Oddly, the testsuite framework doesn't actually run the test; I have no idea why. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13031#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC