Re: [PATCH 0/3] Work around icc miscompilation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Xi Wang <xi(dot)wang(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH 0/3] Work around icc miscompilation
Date: 2013-02-23 17:25:52
Message-ID: 9395.1361640352@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark <stark(at)mit(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xi Wang 2013-02-23 17:39:21 Re: [PATCH 0/3] Work around icc miscompilation
Previous Message Greg Stark 2013-02-23 17:06:08 Re: [PATCH 0/3] Work around icc miscompilation