On Freitag 02 Dezember 2005 12:48, Melchior FRANZ wrote:
> * Mathias Fröhlich -- Friday 02 December 2005 07:35:
> > float
> > XDR_decode_float ( const xdr_data_t & f_Val )
> > {
> >     union {
> >       float f;
> >       xdr_data_t x;
> >     } tmp;
> >     tmp.x = XDR_decode_int32 (f_Val);
> >     return tmp.f;
> > }
>
> This works.
Aliasing rules roughtly tell that pointers to different types not contained in 
each other are assumed to point at different locations.
The original way gcc identifies that int store on the stack as a dead store as 
it will never be read again - a float is read that cannot point to the same 
address.
That it worked with making that variable static is propably that gcc did not 
see that nowhere in the range of visibility of that static variable, this 
variable ever read. If it would be smart enough to see that it would also 
optimize that store away may be including the static variable itself.

   Greetings

          Mathias

-- 
Mathias Fröhlich, email: [EMAIL PROTECTED]

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to