problem with alias-safe code

Richard Henderson rth@cygnus.com
Sun Jun 28 11:19:00 GMT 1998


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~



More information about the Gcc-patches mailing list