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

From: Xi Wang <xi(dot)wang(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [PATCH 0/3] Work around icc miscompilation
Date: 2013-01-24 10:30:58
Message-ID: 51010D62.2010101@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/24/13 5:02 AM, Heikki Linnakangas wrote:
> These patches look ok at a quick glance, but how do we ensure this kind
> of problems don't crop back again in the future? Does icc give a warning
> about these? Do we have a buildfarm animal that produces the warnings?
>
> If we fix these, can we stop using -frapv on gcc? Is there any way to
> get gcc to warn about these?

Thanks for reviewing.

gcc has this -Wstrict-overflow option to warn against overflow checks
that may be optimized away. The result in inaccurate: it may produce
a large number of false warnings, and it may also miss many cases (esp.
when gcc's value-range-propagation fails to compute variables' ranges).

Not sure if other compilers have similar options.

I find these broken checks using a static checker I'm developing, and
only report cases that existing compilers do miscompile. If you are
interested, I'll post a complete list of overflow checks in pgsql that
invoke undefined behavior and thus may be killed by future compilers.

I believe we can get rid of -fwrapv once we fix all such checks.

- xi

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-01-24 10:38:25 Re: logical changeset generation v4 - Heikki's thoughts about the patch state
Previous Message Amit Kapila 2013-01-24 10:26:36 Re: patch submission: truncate trailing nulls from heap rows to reduce the size of the null bitmap [Review]