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