[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=
#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 
participants (1)
- 
                
GHC