This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: problem with alias-safe code
- To: mark at markmitchell dot com, rth at cygnus dot com
- Subject: Re: problem with alias-safe code
- From: Richard Henderson <rth at cygnus dot com>
- Date: Sun, 28 Jun 1998 11:22:39 -0700
- Cc: drepper at cygnus dot com, egcs-patches at cygnus dot com
- References: <r2ogveu5ch.fsf.cygnus.egcs.bugs@happy.cygnus.com> <199806280549.WAA17031@dot.cygnus.com> <199806281738.KAA10283@smtp.earthlink.net>
- Reply-To: Richard Henderson <rth at cygnus dot com>
On Sun, Jun 28, 1998 at 10:38:50AM -0700, Mark Mitchell wrote:
> Oh, dear. I always get bogged down in these GCC extensions. I'm sure
> there's a good reason for them, but in this case why not just write:
>
> double my_fabs (double x)
> {
> union u_t { double d; int i[2]; };
> ((union u_t*) &x)->i[1] &= 0x7fffffff;
> return x;
> }
Oh. Mostly cause we thought that the address-taking there would also
run afoul of the alias code, and that our only safe and standard option
was to copy the data into a union before manipulating it.
r~