BUG #4052: GCC update -fwrapv and new -Wstrict-overflow

From: "" <mjevans1983(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4052: GCC update -fwrapv and new -Wstrict-overflow
Date: 2008-03-24 16:20:50
Message-ID: 200803241620.m2OGKofU088602@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4052
Logged by:
Email address: mjevans1983(at)gmail(dot)com
PostgreSQL version: 8.3.1
Operating system: Linux
Description: GCC update -fwrapv and new -Wstrict-overflow
Details:

http://www.airs.com/blog/archives/120

-Wstrict-overflow=5 can be used to find cases where optimizations break not
standard specified overflow cases. (However it sounds like even at level 5
it will only highlight cases that break, not all overflows?)

Quoting:
"However, gcc does need to respond to the concerns of the user community. I
introduced two new options in gcc 4.2. The first is -fno-strict-overflow.
This tells the compiler that it may not assume that signed overflow is
undefined. The second is -Wstrict-overflow. This tells the compiler to warn
about cases where it is using the fact that signed overflow is undefined to
implement an optimization. With these options it is possible to detect cases
where signed overflow occurs in a program, and it is possible to disable
optimizations which rely on signed overflow until the program is fixed. The
-Wstrict-overflow warning even found one minor case where gcc itself relied
on wrapping signed overflow, in the handling of division by the constant
080000000."

With a special comment:
"ncm said,

January 10, 2008 @ 2:53 pm

I see what happened:

$ gcc -O3 -Wstrict-overflow=5 -Wall -c t.c

is not the same as

$ gcc -O3 -Wall -Wstrict-overflow=5 -c t.c

Evidently the -Wall in the first example bumps the warning level back down
to 1. ..."

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-03-24 17:09:33 Re: BUG #4052: GCC update -fwrapv and new -Wstrict-overflow
Previous Message Pavan Deolasee 2008-03-24 13:24:56 Re: BUG #4051: ERROR: relation with OID xxxx does not exist