Re: Anyone for adding -fwrapv to our standard CFLAGS?

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Anyone for adding -fwrapv to our standard CFLAGS?
Date: 2005-12-13 01:02:00
Message-ID: 1134435720.15554.28.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2005-12-12 at 16:19 -0500, Tom Lane wrote:
> It seems that gcc is up to some creative reinterpretation of basic C
> semantics again; specifically, you can no longer trust that traditional
> C semantics of integer overflow hold:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=175462
>
> While I don't think we are anywhere using exactly the same trick that
> the referenced mysql code is using, it certainly seems likely to me that
> a compiler that is willing to replace "x < 0 && -x < 0" with "false"
> might be able to break some of the integer overflow checks we do use.

IMHO code that makes assumptions about overflow behavior beyond what is
defined by the standard is asking for trouble, whether those assumptions
are "traditional C semantics" or not. Given that -fwrapv apparently
hurts performance *and* you've presented no evidence that we actually
need the flag in the first place, I'm not sold on this idea...

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-12-13 01:07:51 Re: How much expensive are row level statistics?
Previous Message Luke Lonergan 2005-12-13 00:21:01 Re: Which qsort is used