From c04b6232f86f98a7e36e649212c62b45ed735415 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 25 Sep 2017 08:19:10 +0000 Subject: Fix overflow detection for LLP64 arch [Bug #13748] 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. patched by Lars Kanis git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 9fac330218..2521e11e6f 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 -- cgit v1.2.3