Subject: [bug#75745] [PATCH] gnu: hugs: Ignore integer overflow.

From: [email-masked]
Date: Fri, 24 Jan 2025 21:45:38 +0200

Lars-Dominik Braun kirjoitti 2025-01-24 16:00:
> Hi,
> 
>> This is required to bootstrap MicroHs.
> 
> at first glance and without much background knowledge this looks like
> a really bad idea(tm). Do you know why this patch is required (i.e. why
> MicroHs relies on this specific overflow behavior)?
> 
> Lars

Hi,

No idea, I tried grepping both large numbers and fromInteger usage, as 
well as grep -i overflow, however not crashing in conversion from 
Integer to Int is consistent behavior and might be assumed by a lot of 
packages, like if you try:
ghci> fromInteger (9 ^ 100) :: Int
6627890308811632801

I remember several years ago seeing (unrelated to MicroHs) code that for 
performance reasons uses integer overflow with division by some power of 
2 (i++ / (1 << N)) for circular array (queue) to pass messages between 
threads, so having it overflow or underflow is not always a bug.

This message is sent to [email-masked] and so is visible to 
public at https://issues.guix.gnu.org/75745 or if it doesn't work at 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75745