On Freitag 02 Dezember 2005 02:29, Melchior FRANZ wrote:
> Is it a gcc 4.0.2 (SuSE 10.0) compiler bug? tiny_xdr.cxx contains
> this function;
>
>   float
>   XDR_decode_float ( const xdr_data_t & f_Val )
>   {
>       float* tmp;
>       xdr_data_t dummy;
>
>       dummy = XDR_decode_int32 (f_Val);
>       tmp = (float*) &dummy;
>       return (*tmp);
>   }
>
>
> And it turned out that when compiled with gcc 4.0.2 the return
> value wasn't safe. When called three times in a row with different
> values, we would get three times the same result. None of those
> correct. This placed MP aircraft somewhere around the middle
> of our Earth. For those understanding x86 assembler, here is
> the resulting code (why does it not call _Z16XDR_decode_int32RKj?
> "Optimized" away?):

Try with -fno-strict-aliasing
:)
I for myself really like this feature in C/C++ called 'aliasing rules'. It 
enables the optimizer to do really good jobs in reodering instructions and 
eliminating dead stores which in the end keeps the CPU piplines full.
But be careful with casts like this one ...

Greetings

        Mathias

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

_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to