Bogus calculation of bottoming arity
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |