This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type based aliasing again
- To: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Subject: Re: type based aliasing again
- From: Bernd Schmidt <bernds at cygnus dot co dot uk>
- Date: Tue, 14 Sep 1999 13:52:27 +0100 (BST)
- cc: Joe Buck <jbuck at synopsys dot COM>, gcc at gcc dot gnu dot org, rms at gnu dot org
>
> But isn't exactly this work-around that we've have been recommending
> to the Linux folks? Houston, we have a problem! :-) / 2
>
> How about:
>
> double x;
> ((union foo *)&x)->a = 2.0;
> ((union foo *)&x)->b[1] = 0;
>
> Would this work?
It might just. (Note I'm being cautious ;-)
The accesses are all through a union, so it's covered by our extension
(quickly "verified" by compiling and checking all the alias sets are zero in
the rtl dump), and since x isn't accessed in its own type, it shouldn't
trigger the MEM_IN_STRUCT/MEM_SCALAR_P tests either. Still, declaring x as a
union is probably safer.
Bernd