Fix corner-case 64-bit integer subtraction bug on some platforms.
Dean Rasheed <dean.a.rasheed@gmail.com>
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_MIN. Back-patch to all supported branches. Patch be me. Thanks to Jian He for initial investigation, and Laurenz Albe and Tom Lane for review. Discussion: https://postgr.es/m/CAEZATCUNK-AZSD0jVdgkk0N%3DNcAXBWeAEX-QU9AnJPensikmdQ%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/include/common/int.h | modified | +5 −1 |
| src/test/regress/expected/int8.out | modified | +2 −0 |
| src/test/regress/sql/int8.sql | modified | +1 −0 |
Discussion
- 64-bit integer subtraction bug on some platforms 3 messages · 2023-11-08