This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: IMA vs tree-ssa
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: Neil Booth <neil at daikokuya dot co dot uk>, Richard Henderson <rth at redhat dot com>, GCC List <gcc at gcc dot gnu dot org>, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Mark Mitchell <mark at codesourcery dot com>
- Date: 01 Apr 2004 16:35:26 -0800
- Subject: Re: IMA vs tree-ssa
- References: <F0209661-68A9-11D8-8C0E-000A95D7CD40@apple.com><20040226230842.GA28463@redhat.com> <jmwu698lfu.fsf@desire.geoffk.org><20040227211712.GB16448@daikokuya.co.uk><jmoerk8ae8.fsf@desire.geoffk.org><20040227220212.GC16448@daikokuya.co.uk><404CF3C5.4070803@codesourcery.com><m3n06rlzgj.fsf@uniton.integrable-solutions.net><20040308153208.A23517@synopsys.com><61884C8A-715D-11D8-87F8-000A95D7CD40@apple.com>
Dale Johannesen <dalej@apple.com> writes:
> On Mar 8, 2004, at 3:32 PM, Joe Buck wrote:
> > On Mon, Mar 08, 2004 at 11:57:00PM +0100, Gabriel Dos Reis wrote:
> >> [#2] All declarations that refer to the same object or
> >> function shall have compatible type; otherwise, the behavior
> >> is undefined.
> > This would seem to suggest that in the situations where non-transitive
> > behavior would otherwise result (for example, an incomplete struct
> > type is
> > compatible with two distinct and incompatible definitions of that
> > struct
> > type), and this matters (for the purpose of aliasing analysis, for
> > example), we have undefined behavior, so the compiler should be able to
> > act as though this situation does not arise and assume transitivity.
>
> Suppose we have 3 types T1, T2, Tcom such that T1 and T2
> are not compatible, but Tcom is compatible with either T1 or T2.
> Let's call the relationship between T1 and T2 "pseudo-compatible".
> Then:
>
> Tcom x;
> T1 * p = (T1 *)&x;
> T2 * q = (T2 *)&x;
>
> foo()
> {
> T1 x = *p;
> *q = ...
> }
Could you elaborate a bit on this example? I don't believe you can write
T1 x = *p;
*q = ...
in this case, because one of *p or *q will be incomplete.
> This is not undefined behavior, and the standard says that p and q
> don't alias in foo.
It does, that it says that if you write
p = &x;
q = &y;
then you can interchange those two assignments. It does not, however,
say that *p and *q don't alias.
--
- Geoffrey Keating <geoffk@geoffk.org>