Hello hackers, I've just finished debugging a silly yet subtle bug where expressions like `(fx*? 1 (fx*? #xffffffff #xffffffff))` would evaluate to 3 instead of #f. Attached is a patch that makes `fx*?` aware of non-fixnum arguments and makes it behave like the other `fx?` operators and return #f. The .patch is made against the chicken-5 branch and I think applies cleanly to master.
Cheers, Lemonboy
From b53ff32298abb7ef5f335237fac1d03eb2216e62 Mon Sep 17 00:00:00 2001 From: LemonBoy <thatle...@gmail.com> Date: Mon, 1 May 2017 13:27:06 +0200 Subject: [PATCH] Make fx*? aware of non-fixnum arguments This brings it in line with the other overflow-aware operators. --- runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime.c b/runtime.c index e85b397f..febf4d6c 100644 --- a/runtime.c +++ b/runtime.c @@ -12499,6 +12499,8 @@ C_regparm C_word C_fcall C_i_o_fixnum_times(C_word n1, C_word n2) C_uword c = 1UL<<31UL; #endif + if((n1 & C_FIXNUM_BIT) == 0 || (n2 & C_FIXNUM_BIT) == 0) return C_SCHEME_FALSE; + if((n1 & C_INT_SIGN_BIT) == (n2 & C_INT_SIGN_BIT)) --c; x1 = C_unfix(n1); -- 2.12.2
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers