[Haskell-cafe] Serious bug with Natural in GHC 9.0.1
Emily Pillmore
emilypi at cohomolo.gy
Fri Mar 5 04:55:20 UTC 2021
No worries Sylvain,
Mistakes will be made while improving things, and we caught it, so that's great. Thanks for the head's up and good luck with your ongoing improvements!
Cheers,
Emily
On Thu, Mar 04, 2021 at 4:24 PM, Sylvain Henry < sylvain at haskus.fr > wrote:
>
>
>
> Hi Café,
>
>
>
> 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!
> Sylvain
>
> #19345: https:/ / gitlab. haskell. org/ ghc/ ghc/ -/ issues/ 19345 (
> https://gitlab.haskell.org/ghc/ghc/-/issues/19345 )
> #19411: https:/ / gitlab. haskell. org/ ghc/ ghc/ -/ issues/ 19411 (
> https://gitlab.haskell.org/ghc/ghc/-/issues/19411 )
>
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to: http:/ / mail. haskell.
> org/ cgi-bin/ mailman/ listinfo/ haskell-cafe (
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe ) Only
> members subscribed via the mailman list are allowed to post.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210305/c0b54f55/attachment.html>
More information about the Haskell-Cafe
mailing list