Re: [PATCH 1/3] Fix x + y < x overflow checks - Mailing list pgsql-hackers

From Claudio Freire
Subject Re: [PATCH 1/3] Fix x + y < x overflow checks
Date
Msg-id CAGTBQpabxpp3JMfbeye7nsA0a6-vSw8qnF6M-ezwjPnYeG=G5A@mail.gmail.com
Whole thread Raw
In response to [PATCH 1/3] Fix x + y < x overflow checks  (Xi Wang <xi.wang@gmail.com>)
List pgsql-hackers
On Thu, Jan 24, 2013 at 6:36 AM, Xi Wang <xi.wang@gmail.com> wrote:
> icc optimizes away the overflow check x + y < x (y > 0), because
> signed integer overflow is undefined behavior in C.  Instead, use
> a safe precondition test x > INT_MAX - y.


I should mention gcc 4.7 does the same, and it emits a warning.



pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: Back-branch update releases coming in a couple weeks
Next
From: Hari Babu
Date:
Subject: Re: Passing connection string to pg_basebackup