On Mon, 10 Mar 2008, Tom Lane wrote:

I am wondering if these checks have been no-ops in Postgres builds done with gcc 4.1 and up, and we're only just now being told about it.


Since gcc 4.2 supports -Wstrict-overflow, I rebuilt pg with that to see what it's doing currently. I'm not sure what -Wstrict-overflow level -Wall implies with gcc 4.3, but I cranked it up to 5 on 4.2 to get the most details out of it. I don't see any of the warnings I saw on 4.3 and I get the attached list which looks less dangerous spot checking a couple items, but I haven't gone through the whole list.

Additionally the comments in the blog posting[1] I linked to previously, a user asks, "how come I don't see any warnings with -Wstrict-overflow on gcc 4.2.3" and it's answered "I think the full effects only come in on gcc mainline. At least, gcc 4.2 does not eliminate the loop, but gcc 4.3 will." So clearly 4.3 is doing something new here, but that doesn't prove we're safe on previous versions.

[1] http://www.airs.com/blog/archives/120

Kris Jurka
exec.c:245: warning: assuming signed overflow does not occur when changing X +- 
C1 cmp C2 to X cmp C1 +- C2
exec.c:245: warning: assuming signed overflow does not occur when changing X +- 
C1 cmp C2 to X cmp C1 +- C2
localtime.c:322: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
localtime.c:814: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
pgtz.c:480: warning: assuming signed overflow does not occur when distributing 
negation across division
pgtz.c:492: warning: assuming signed overflow does not occur when distributing 
negation across division
pgtz.c:503: warning: assuming signed overflow does not occur when distributing 
negation across division
zic.c:862: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
heaptuple.c:1018: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
heaptuple.c:1845: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
heaptuple.c:907: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
gram.y:9471: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
gistutil.c:185: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
gistutil.c:307: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
gistutil.c:417: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
parse_node.c:70: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
copy.c:2613: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
gistsplit.c:494: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
tuptoaster.c:1017: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
tuptoaster.c:590: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
nbtutils.c:74: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
freespace.c:1567: warning: assuming signed overflow does not occur when 
simplifying division
freespace.c:1568: warning: assuming signed overflow does not occur when 
simplifying division
freespace.c:1637: warning: assuming signed overflow does not occur when 
simplifying division
freespace.c:1638: warning: assuming signed overflow does not occur when 
simplifying division
arrayfuncs.c:2837: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
arrayfuncs.c:2701: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
dict.c:63: warning: assuming signed overflow does not occur when simplifying 
multiplication
arrayfuncs.c:314: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
cash.c:312: warning: assuming signed overflow does not occur when negating a 
division
spell.c:1181: warning: assuming signed overflow does not occur when simplifying 
multiplication
deadlock.c:790: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
spell.c:1119: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
s_lock.c:150: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
s_lock.c:155: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
datetime.c:2072: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
format_type.c:408: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
int.c:1130: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
like_match.c:163: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
like_match.c:163: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
int8.c:631: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
numeric.c:1625: warning: assuming signed overflow does not occur when 
simplifying division
numeric.c:4756: warning: assuming signed overflow does not occur when 
simplifying division
numeric.c:5391: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
numeric.c:5288: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
oracle_compat.c:1284: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
oracle_compat.c:1284: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
numeric.c:3034: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
varbit.c:1405: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
varbit.c:1330: warning: assuming signed overflow does not occur when 
simplifying / or % to >> or &
varlena.c:692: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
varlena.c:692: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
varlena.c:1733: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
formatting.c:2840: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
formatting.c:2894: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
formatting.c:3655: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
formatting.c:3721: warning: assuming signed overflow does not occur when 
changing X +- C1 cmp C2 to X cmp C1 +- C2
dbsize.c:423: warning: assuming signed overflow does not occur when simplifying 
/ or % to >> or &
tsvector_op.c:803: warning: assuming signed overflow does not occur when 
simplifying multiplication
tsvector_op.c:812: warning: assuming signed overflow does not occur when 
simplifying multiplication
fe-print.c:714: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
dt_common.c:1392: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
preproc.y:207: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
initdb.c:1108: warning: assuming signed overflow does not occur when 
simplifying division
initdb.c:1133: warning: assuming signed overflow does not occur when 
simplifying division
initdb.c:1160: warning: assuming signed overflow does not occur when 
simplifying division
initdb.c:304: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
pg_ctl.c:851: warning: assuming signed overflow does not occur when simplifying 
conditional to constant
pl_exec.c:3679: warning: assuming signed overflow does not occur when 
simplifying conditional to constant
plperl.c:1729: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
plperl.c:1729: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
plpython.c:1703: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
plpython.c:1703: warning: assuming signed overflow does not occur when changing 
X +- C1 cmp C2 to X cmp C1 +- C2
pltcl.c:2271: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
pltcl.c:2271: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
pltcl.c:2340: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
pltcl.c:2340: warning: assuming signed overflow does not occur when changing X 
+- C1 cmp C2 to X cmp C1 +- C2
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to