jcbeaudoin / MKCL

ManKai Common Lisp
Other
33 stars 8 forks source link

Negative fixnum overflow in mkcl_ash #31

Closed davidmullen closed 6 months ago

davidmullen commented 6 months ago
> (ash (1- most-negative-fixnum) 1)

-4611686018427387906

Which is fine—but then:

> (ash most-negative-fixnum 1)

0
jcbeaudoin commented 6 months ago

The code in mkcl_ash() seems to be ignoring the sign bit of the shifted original value.

jcbeaudoin commented 6 months ago

I think I have a fix. I'll commit it later today after I twiddle it a bit more.

jcbeaudoin commented 6 months ago

Could you please try commit 9f2296c on master/head to see if it fixes the issue.

davidmullen commented 6 months ago

I ran a bunch of randomized tests (both compiled and interpreted) and everything looks OK.