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

From Tom Lane
Subject Re: fix for strict-alias warnings
Date
Msg-id 10268.1066166604@sss.pgh.pa.us
Whole thread Raw
In response to Re: fix for strict-alias warnings  (Manfred Spraul <manfred@colorfullife.com>)
List pgsql-patches
Manfred Spraul <manfred@colorfullife.com> writes:
> Tom Lane wrote:
>> Is gcc 3.3 smart enough to optimize away the pointer alignment test
>> in the full macro?
>>
> 3.2 optimizes away the pointer alignment test, but then doesn't pipeline
> the "x*x" calculation.

Hm, confirmed here.  So indeed it seems that Bruce was on the right
track --- setting up a Node structure as a local variable may be a
contributing factor.

> I don't have gcc 3.3 installed, but IMHO it would be insane to leave
> strict alias analysis enabled - writing to *(int32*)addr violates the
> alias rules, the bad code generated with MemSetAligned proved that.

While I don't really disagree, I am curious as to whether we are
actually forestalling any bugs; so far I'm not convinced that the
reported warnings correspond to real risks ...

            regards, tom lane

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: fix for strict-alias warnings
Next
From: Tom Lane
Date:
Subject: Re: psql tab completion bug and possible fix