~ chicken-core (chicken-5) 2d03fb5cebcd35e5dba2b82bad7442dafe423029
commit 2d03fb5cebcd35e5dba2b82bad7442dafe423029
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Sep 2 04:22:49 2010 -0400
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Thu Sep 2 04:22:49 2010 -0400
fixnum-+/- with overflow check wrong for 64-bit systems
diff --git a/runtime.c b/runtime.c
index 3b8076e2..ca4de104 100644
--- a/runtime.c
+++ b/runtime.c
@@ -8585,7 +8585,11 @@ C_regparm C_word C_fcall C_i_o_fixnum_plus(C_word n1, C_word n2)
x2 = C_unfix(n2);
s = x1 + x2;
+#ifdef C_SIXTY_FOUR
+ if((((s ^ x1) & (s ^ x2)) >> 62) != 0) return C_SCHEME_FALSE;
+#else
if((((s ^ x1) & (s ^ x2)) >> 30) != 0) return C_SCHEME_FALSE;
+#endif
else return C_fix(s);
}
@@ -8600,7 +8604,11 @@ C_regparm C_word C_fcall C_i_o_fixnum_difference(C_word n1, C_word n2)
x2 = C_unfix(n2);
s = x1 - x2;
+#ifdef C_SIXTY_FOUR
+ if((((s ^ x1) & ~(s ^ x2)) >> 62) != 0) return C_SCHEME_FALSE;
+#else
if((((s ^ x1) & ~(s ^ x2)) >> 30) != 0) return C_SCHEME_FALSE;
+#endif
else return C_fix(s);
}
Trap