This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: alias.c:nonoverlapping_component_refs_p
- From: Bernd Schmidt <bernds at redhat dot com>
- To: Geert Bosch <bosch at gnat dot com>
- Cc: Daniel Berlin <dan at cgsoftware dot com>, Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 3 Dec 2001 16:00:54 +0000 (GMT)
- Subject: Re: alias.c:nonoverlapping_component_refs_p
On Mon, 3 Dec 2001, Geert Bosch wrote:
> On Monday, December 3, 2001, at 08:11 , Daniel Berlin wrote:
> > On Mon, 3 Dec 2001, Richard Kenner wrote:
> >> I don't believe it is safe to conclude that if two fields aren't
> >> the same,
> >> they don't overlap. An example of a case where they do is an Ada
> >> subtype
> >> of a variant record.
> >
> > On a RECORD_TYPE, it should be safe.
>
> Even for C I'm not sure this is always safe. For example, if we have a
> struct in C with two tightly packed char's, then it may be the case
> that writing to one field requires updating both (presumably using
> masking to preserve the old value). How would one represent this kind
> of aliasing?
This is not something that should be visible at the tree level. If a
target requires this, it will presumably replace a MEM:QI with a MEM:SI
at some point, and at that point any annotation for the QImode MEM can
be adjusted (e.g. to say the SImode MEM can alias anything).
Bernd