summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-04-27 22:01:58 +0200
committerAndreas Klebinger <klebinger.andreas@gmx.at>2022-04-30 18:58:00 +0000
commitedb81f4ed82e6317b03a0c540e1adca194da38d7 (patch)
treedabba413bc33b97af10857ca934299dff1cec4ab /compiler/GHC/Core
parent5630dde68185f96da026a4e0c722fe6631633299 (diff)
downloadhaskell-wip/andreask/deadend-fix.tar.gz
exprIsDeadEnd: Use isDeadEndAppSig to check if a function appliction is bottoming.wip/andreask/deadend-fix
We used to check the divergence and that the number of arguments > arity. But arity zero represents unknown arity so this was subtly broken for a long time! We would check if the saturated function diverges, and if we applied >=arity arguments. But for unknown arity functions any number of arguments is >=idArity. This fixes #21440.
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r--compiler/GHC/Core/Utils.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs
index d6653fd387..b7b1c9334b 100644
--- a/compiler/GHC/Core/Utils.hs
+++ b/compiler/GHC/Core/Utils.hs
@@ -1087,7 +1087,7 @@ exprIsDeadEnd e
| otherwise
= go 0 e
where
- go n (Var v) = isDeadEndId v && n >= idArity v
+ go n (Var v) = isDeadEndAppSig (idDmdSig v) n
go n (App e a) | isTypeArg a = go n e
| otherwise = go (n+1) e
go n (Tick _ e) = go n e