Skip to content
Snippets Groups Projects
Commit 278b6059 authored by Tom Lane's avatar Tom Lane
Browse files

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.

Back-patch of commit 1f7cb5c3.

Per discussion with Xi Wang, though this is different from the patch he
submitted.
parent 83d48a81
No related branches found
Tags REL8_3_RC1
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment