patch for GCC floating-point nonsense bug
Ulrich Drepper
drepper@ipd.info.uni-karlsruhe.de
Sun Nov 9 19:39:00 GMT 1997
Paul Eggert <eggert@twinsun.com> writes:
> Here's a proposed patch for this GCC bug. While I was fixing it
> I found what appear to be other instances of the bug; this patch fixes
> all the instances that I found.
Are you sure this is correct? I compiled egcs using this patch and I
get bogus results. The bit patterns generated for the constants are
somewhat random. E.g., here are the results for the function I sent
in the last mail for a return value of `long double' (again on ix86):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.align 4
.LC2:
.long 0xbe000000,0xf76080de,0xbbc8
.align 4
.LC3:
.long 0x387c,0xeb7cbfff,0x403e
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Even when using `double' the -0.0 constant is wrong (0.0 is ok).
> + #define REAL_VALUES_IDENTICAL(x, y) \
> + (!bcmp ((char *) &(x), (char *) &(y), sizeof (REAL_VALUE_TYPE)))
This makes me wonder since there are no separate constants for float
and long double. I.e., a bitwise compare will fail.
I saw that the patch removed some similar bcmp call but this probably
is also wrong.
-- Uli
---------------. drepper at gnu.org ,-. Rubensstrasse 5
Ulrich Drepper \ ,-------------------' \ 76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com `------------------------
More information about the Gcc-bugs
mailing list