From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernd Schmidt To: Alexandre Oliva Cc: Joe Buck , gcc AT gcc.gnu.org, rms AT gnu.org Subject: Re: type based aliasing again Date: Tue, 14 Sep 1999 05:52:00 -0000 Message-id: References: X-SW-Source: 1999-09/msg00527.html > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernd Schmidt To: Alexandre Oliva Cc: Joe Buck , gcc@gcc.gnu.org, rms@gnu.org Subject: Re: type based aliasing again Date: Thu, 30 Sep 1999 18:02:00 -0000 Message-ID: References: X-SW-Source: 1999-09n/msg00527.html Message-ID: <19990930180200.5Odhx7NCVvOffSGsb_qcP1wlJTqQaxliR4ajVWCunG8@z> > > 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