Bug #13748
closed[PATCH] Fix mul overflow detection for LLP64 arch.
Description
FIXNUMs are expected to fit into a long type, but the test in MUL_OVERFLOW_FIXNUM_P() is about the VALUE type. Since long is smaller than VALUE on LLP64, the overflow is not detected. As an exemplary result "2**31" evaluates to "-2147483648" instead of "2147483648" on Windows when built with gcc-7.1.0.
This also results in many more test failures as described in this github issue: https://github.com/oneclick/rubyinstaller2/issues/55
gcc versions before 7.1.0 don't provide __builtin_mul_overflow_p() and ruby-2.4.x doesn't use this function, so that they don't show this broken behavior.
The attached patch fixes the issue. However I'm currently unable to run a full "make test-all" to verify whether this fixes all gcc-7.1.0 related issues.
Files