Re: fix for strict-alias warnings

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "PG Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: fix for strict-alias warnings
Date: 2003-10-14 11:37:05
Message-ID: 002901c39247$7e720200$6401a8c0@DUNSLANE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>
> I have to agree now with Andrew's last mail that -fno-strict-aliasing is
> the only safe solution. Since gcc isn't even pretending that it can
> warn in all cases where the optimization might break things, I'm not
> sure we could ever responsibly enable this optimization. I do not feel
> this is our problem; it is the compiler hackers' fault if they need to
> make unsupportable, untestable assumptions about application code.
>
> Basically, ISO broke the language here, and I say it's a screwup up with
> which we need not put.
>

You and Linus Torvalds ;-) I recall seeing almost this exact discussion on
the kernel hackers list a few years ago.

Of course, the linux kernel is aimed at a limited set of compilers - as I
understand it basically gcc although it has been made to build with Intel
compilers - which makes things somewhat easier for them. What is our target
set of compilers? What is our target version of C? (being unsure on these
issues I gave my initdb.c a tour through "gcc -ansi -pedantic" at one
stage).

Also note that uninhibited casting between types can still cause alignment
problems, quite apart from the strict aliasing issue (That was what confused
Bruce, I think - the email on the netbsd list referred to both strict
aliasing issues and misalignment issues). Still, that apparently hasn't been
a problem up to now so we are probably OK on this one.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-10-14 12:53:11 Re: Heading to final release
Previous Message Peter Galbavy 2003-10-14 08:59:58 Re: 2-phase commit

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-10-14 14:00:07 Re: fix for strict-alias warnings
Previous Message mirko tebaldi 2003-10-14 10:26:55 Invio in corso posta elettronica: postgres-it.po.bz2