Re: fix for strict-alias warnings - Mailing list pgsql-patches

From Andrew Dunstan
Subject Re: fix for strict-alias warnings
Date
Msg-id 005b01c3914b$a80dfe90$6401a8c0@DUNSLANE
Whole thread Raw
In response to Re: fix for strict-alias warnings  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: fix for strict-alias warnings
List pgsql-patches
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I have attached and applied the following patch to use makeNode for
> > structures that will later be cast to Node*, rather than having them be
> > allocated as stack variables.
>
> AFAICT, this adds unnecessary palloc overhead without actually reducing
> the risk of optimization problems.
>

Even without the extra overhead, the danger of strict-aliasing is not just
related to alignment. As I understand it, given strict-aliasing assumptions
the compiler is free to reorder some operations on things it thinks can't be
the same thing, or even optimise them away because they can have no effect.
I'm not 100% sure we have avoided that danger.

Quote from nice page on this subject: "ISO C is not your grandfather's C".
:-)

cheers

andrew


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: fix for strict-alias warnings
Next
From: Tom Lane
Date:
Subject: Re: fix for strict-alias warnings