Re: [PATCHES] fix for strict-alias warnings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "PostgreSQL Hackers Mailing List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] fix for strict-alias warnings
Date: 2003-10-13 14:52:17
Message-ID: 14394.1066056737@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Andrew Dunstan" <andrew(at)dunslane(dot)net> writes:
> I was inder the impression, perhaps incorrectly, the casting the pointers to
> (void *) would inhibit the compiler from making any assumptions about what
> it pointed to, and hence inhibit bad effects from those assumptions. The
> only way to know would be to examine the assembler output, I suppose. The
> alternative is that it would merely inhibit the compiler from issuing a
> warning and mask a bad effect. That would be nasty

IIUC the issue is whether the compiler might incorrectly rearrange the
order of operations based on the assumption that two pointers point
to different storage (when in fact they point to the same storage).
I don't see what about introducing "(void *)" would be likely to keep
the compiler from making such assumptions --- you'll still have the same
two pointers and the exact same sequence of operations. Accordingly,
I think it's very likely that the so-far-proposed patches are indeed
masking the symptom and not solving the real problem.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-10-13 15:10:42 Re: [PATCHES] fix for strict-alias warnings
Previous Message Bruce Momjian 2003-10-13 14:39:04 Re: http://www.pgsql.com/register/submit.php

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2003-10-13 15:10:42 Re: [PATCHES] fix for strict-alias warnings
Previous Message Andrew Dunstan 2003-10-13 11:18:16 Re: [PATCHES] fix for strict-alias warnings