Subject: Re: [PATCH] gnu: hugs: Ignore integer overflow.

From: Lennart Augustsson <[email-masked]>
Date: Sat, 25 Jan 2025 00:14:46 +0100

I actually checked carefully. MicroHs does not rely on any overflow
behaviour. There are no large Integers being used.
I believe this is a Hugs bug caused by Hugs assuming that Int is 32 bits,
but being compiled on a 64 bit platform.

Another example of such a bug is that it looks like the StablePtr
implementation casts 64 bit pointers to and from 32 bit int.

If someone fixes all the warnings when compiling Hugs, then I bet this
problem goes away. But I am not going to do that. In its current state Hugs
can compile a fully functional MicroHs, and that's enough for me.

Lennart

On Fri, Jan 24, 2025, 22:06 <[email-masked]> wrote:

> > 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.
>
> Correction, it was: i++ & (1 << N)
>
> But you get the idea.
>