From 32455f5a8c52d1ab3de4122f6d2e659835a7e9fb Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Sat, 15 Jul 2017 15:06:49 +0200 Subject: [PATCH] Fix overflow detection for LLP64 arch. FIXNUMs are expected to fit into a long type, but the test is about a VALUE type. Since long is < than VALUE on LLP64, the overflow is not detected. As a result "2**31" evaluates to "-2147483648" on Windows with gcc-7.1.0. --- internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal.h b/internal.h index 81f4d2b..5b132ad 100644 --- a/internal.h +++ b/internal.h @@ -115,7 +115,7 @@ extern "C" { /* __builtin_mul_overflow_p can take bitfield */ /* and GCC permits bitfields for integers other than int */ #define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \ - struct { SIGNED_VALUE fixnum : SIZEOF_VALUE * CHAR_BIT - 1; } c; \ + struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \ __builtin_mul_overflow_p((a), (b), c.fixnum); \ }) #else -- 2.5.0.windows.1