Need -fwrapv or -fno-strict-overflow for gcc-4.3

From: Kris Jurka <books(at)ejurka(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Need -fwrapv or -fno-strict-overflow for gcc-4.3
Date: 2008-03-10 05:42:01
Message-ID: Pine.BSO.4.64.0803100130580.30353@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


A while back Tom Lane presented the potential problem with gcc signed
overflow handling, but now it's not just a theoretical problem.

http://archives.postgresql.org/pgsql-hackers/2005-12/msg00635.php

Gcc 4.3 has started to perform optimizations based on the denial of the
existence of signed overflow. Building CVS HEAD with gcc 4.3rc2 I get the
following warnings:

localtime.c:1223: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
localtime.c:1227: warning: assuming signed overflow does not occur when
assuming that (X - c) > X is always false
array_userfuncs.c:100: warning: assuming signed overflow does not occur
when assuming that (X - c) > X is always false
float.c:2696: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
float.c:2712: warning: assuming signed overflow does not occur when
assuming that (X + c) < X is always false
oracle_compat.c:1479: warning: assuming signed overflow does not occur
when assuming that (X + c) < X is always false

I don't understand the difference between -fwrapv and
-fno-strict-aliasing, but it seems we need at least one of them.

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

Kris Jurka

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-10 06:10:33 Re: Need -fwrapv or -fno-strict-overflow for gcc-4.3
Previous Message Tom Lane 2008-03-10 03:40:30 Re: Negative LIMIT and OFFSET?