<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Café,</p>
<p>I've made a mistake while implementing constant folding for
Natural numbers in GHC 9.0.1 that hasn't been caught before the
release. It's a rather serious bug as any number converted into
`Natural` with `fromIntegral` can be truncated to Word range if a
bogus rule is triggered (see #19345 and #19411 for more details).</p>
<p>It is already fixed in HEAD and the fix will be present in GHC
9.0.2 which should be released soon.</p>
<p>In the meantime you can check if the rule is triggered with
`-ddump-rule-firings`. If it shows that the following rule has
fired, then your code may be badly modified:</p>
<p><code>Rule fired: fromIntegral/Int->Natural (GHC.Real)</code></p>
<p>(the issue is that despite its name the rule isn't correctly
constrained to convert Ints into Natural, but any numeric
type...).</p>
Sorry about that!<br>
Sylvain
<p>#19345: <a class="moz-txt-link-freetext" href="https://gitlab.haskell.org/ghc/ghc/-/issues/19345">https://gitlab.haskell.org/ghc/ghc/-/issues/19345</a><br>
#19411: <a class="moz-txt-link-freetext" href="https://gitlab.haskell.org/ghc/ghc/-/issues/19411">https://gitlab.haskell.org/ghc/ghc/-/issues/19411</a></p>
<p><br>
</p>
</body>
</html>