mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 <lars@greiz-reinsdorf.de> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2c644a50ce
commit
c04b6232f8
1 changed files with 1 additions and 1 deletions
|
@ -115,7 +115,7 @@ extern "C" {
|
||||||
/* __builtin_mul_overflow_p can take bitfield */
|
/* __builtin_mul_overflow_p can take bitfield */
|
||||||
/* and GCC permits bitfields for integers other than int */
|
/* and GCC permits bitfields for integers other than int */
|
||||||
#define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \
|
#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); \
|
__builtin_mul_overflow_p((a), (b), c.fixnum); \
|
||||||
})
|
})
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue