[Haskell-cafe] Serious bug with Natural in GHC 9.0.1
sylvain at haskus.fr
Thu Mar 4 21:24:37 UTC 2021
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).
It is already fixed in HEAD and the fix will be present in GHC 9.0.2
which should be released soon.
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:
|Rule fired: fromIntegral/Int->Natural (GHC.Real)|
(the issue is that despite its name the rule isn't correctly constrained
to convert Ints into Natural, but any numeric type...).
Sorry about that!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe