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
- Subject: Re: problem with alias-safe code
- From: Ulrich Drepper <drepper at cygnus dot com>
- Date: 28 Jun 1998 11:13:35 -0700
- Cc: rth 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: drepper at cygnus dot com (Ulrich Drepper)
Mark Mitchell <mark@markmitchell.com> writes:
> 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;
> }
This works in the given case but in general such a construct is used
with an arbitrary value for the floating point value. The situation
is that I need macros which extracts from a given floating point value
the words. The FP value can be a memory location like in the fabs
example, but it could also be a rvalue. The gcc extension makes sure
it works in either case.
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------