Re: [PATCH 0/3] Work around icc miscompilation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH 0/3] Work around icc miscompilation
Date
Msg-id 9395.1361640352@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH 0/3] Work around icc miscompilation  (Greg Stark <stark@mit.edu>)
Responses Re: [PATCH 0/3] Work around icc miscompilation
Re: [PATCH 0/3] Work around icc miscompilation
List pgsql-hackers
Greg Stark <stark@mit.edu> writes:
> He's changing things to do

> if (INT_MAX - a > b)
>   PG_THROW ("a+b would overflow")
> else
>   x=a+b;

> Why would a smarter compiler be licensed to conclude that it can
> optimize away anything? "INT_MAX-a > b" is always well defined.

Really?  Can't "INT_MAX - a" overflow?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: [PATCH 0/3] Work around icc miscompilation
Next
From: Xi Wang
Date:
Subject: Re: [PATCH 0/3] Work around icc miscompilation