diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-11-19 12:24:25 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-11-19 12:24:25 -0500 |
commit | 1f7cb5c30983752ff8de833de30afcaee63536d0 (patch) | |
tree | 9a26c3aab4d7475fa1217f0327f19254e9a99a95 /src/backend/utils/adt/numeric.c | |
parent | 644a0a6379afc00803dd89ffe8416514f5dfc217 (diff) | |
download | postgresql-1f7cb5c30983752ff8de833de30afcaee63536d0.tar.gz postgresql-1f7cb5c30983752ff8de833de30afcaee63536d0.zip |
Improve handling of INT_MIN / -1 and related cases.
Some platforms throw an exception for this division, rather than returning
a necessarily-overflowed result. Since we were testing for overflow after
the fact, an exception isn't nice. We can avoid the problem by treating
division by -1 as negation.
Add some regression tests so that we'll find out if any compilers try to
optimize away the overflow check conditions.
This ought to be back-patched, but I'm going to see what the buildfarm
reports about the regression tests first.
Per discussion with Xi Wang, though this is different from the patch he
submitted.
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
0 files changed, 0 insertions, 0 deletions