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

From Manfred Spraul
Subject Re: fix for strict-alias warnings
Date
Msg-id 3F8C641A.2010700@colorfullife.com
Whole thread Raw
In response to Re: fix for strict-alias warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: fix for strict-alias warnings
Re: fix for strict-alias warnings
List pgsql-patches
Tom Lane wrote:

>Manfred Spraul <manfred@colorfullife.com> writes:
>
>
>>After some massaging, I've succeeded in generating bad code using a
>>slightly modified MemSetAligned macro (parameters -O2
>>-fstrict-aliasing): gcc pipelined the x*x around the memset.
>>
>>
>
>As I already explained, we do not care about the MemSetAligned case.
>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. It might be due to a known (and now fixed) bug in
gcc where is lost track of constants, and thus didn't succeed in
optimizing long calculations.

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.
Is someone around with 3.3 who could test MemSet?

--
    Manfred



pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: fix for strict-alias warnings
Next
From: Ian Barwick
Date:
Subject: psql tab completion bug and possible fix