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;
* 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
* 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
* 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
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 )
{
* 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
* 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
* 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
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
* 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
* 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.
* 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
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 )
{
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);
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
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,
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
===
17 matches
Mail list logo