Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-03 Thread Mathias Fröhlich
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;

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Alex Romosan -- Friday 02 December 2005 08:16: Mathias Fröhlich writes: Please use this one. And I believe, without looking into the code, that there are likely more of them ... I'll try all solutions later today. But I don't understand why any of them should be necessary. The code may

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Alex Romosan -- Friday 02 December 2005 08:16: please apply the attached patch which uses static_cast: Haven't yet tested, but it looks good. At least it calls _Z16XDR_decode_int32RKj. :-) (gdb) disass XDR_decode_float Dump of assembler code for function _Z16XDR_decode_floatRKj: 0x0831086e

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Melchior FRANZ -- Friday 02 December 2005 09:57: * Alex Romosan -- Friday 02 December 2005 08:16: please apply the attached patch which uses static_cast: No, this patch doesn't work. m. ___ Flightgear-devel mailing list

Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Harald JOHNSEN
Melchior FRANZ wrote: * Melchior FRANZ -- Friday 02 December 2005 01:43: But ... we weren't really returning the address of an auto var. 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 ) {

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Harald JOHNSEN -- Friday 02 December 2005 11:36: Melchior FRANZ wrote: (why does it not call _Z16XDR_decode_int32RKj? Optimized away?): decode_int32 is a nop on a x86 anyway Huh? Looks like a nop for big-endian: int32_t XDR_decode_int32 ( const xdr_data_t n_Val ) { return

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* 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. Dump of assembler code for function

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Harald JOHNSEN -- Friday 02 December 2005 11:36: Perhaps adding a volatile modifier on the tmp pointer could do the trick (of course doing that disables optimisations). It doesn't. Dump of assembler code for function _Z16XDR_decode_floatRKj: 0x08310816 _Z16XDR_decode_floatRKj+0: push %ebp

Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Andy Ross
Harald JOHNSEN wrote: Is it a gcc 4.0.2 (SuSE 10.0) compiler bug? tiny_xdr.cxx contains this function; dummy = XDR_decode_int32 (f_Val); tmp = (float*) dummy; return (*tmp); This violates the strict aliasing rules that are the default for gcc 4.x -- I believe it issues a warning to that

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-02 Thread Melchior FRANZ
* Andy Ross -- Friday 02 December 2005 16:36: This violates the strict aliasing rules that are the default for gcc 4.x -- I believe it issues a warning to that effect. There's is no warning (using -Wall), and info man page claim that strict aliasing is turned off by default, even if the

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Melchior FRANZ
* Melchior Franz -- Friday 02 December 2005 01:10: Modified Files: tiny_xdr.cxx Log Message: returning addresses of auto vars is *dangerous* [...] But ... we weren't really returning the address of an auto var. Making dummy static fixes the problem, but the reason must be another one.

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Melchior FRANZ
* Melchior FRANZ -- Friday 02 December 2005 01:43: But ... we weren't really returning the address of an auto var. 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

Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Curtis L. Olson
Melchior FRANZ wrote: * Melchior FRANZ -- Friday 02 December 2005 01:43: But ... we weren't really returning the address of an auto var. 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 ) {

Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Mathias Fröhlich
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);

Re: [Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Mathias Fröhlich
By the way: the right fix would be: 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; } Please use this one. And I believe, without looking into the code, that there are likely

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Alex Romosan
Mathias Fröhlich [EMAIL PROTECTED] writes: By the way: the right fix would be: 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; } Please use this one. And I believe,

[Flightgear-devel] Re: CVS: FlightGear/src/MultiPlayer tiny_xdr.cxx, 1.1, 1.2

2005-12-01 Thread Alex Romosan
Mathias Fröhlich writes: Please use this one. And I believe, without looking into the code, that there are likely more of them ... please apply the attached patch which uses static_cast: Index: src/MultiPlayer/tiny_xdr.cxx ===