diff options
author | Paul Eggert <eggert@twinsun.com> | 1997-11-14 00:07:27 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1997-11-13 16:07:27 -0800 |
commit | 41c9120baf04bf432d39a11298f2550292581922 (patch) | |
tree | 1ed9b899bbe18e155415baaf3f9f4beafd425fb0 /gcc/real.h | |
parent | 323d8e7b661297d87002730d2e3f55bca134baaf (diff) | |
download | gcc-41c9120baf04bf432d39a11298f2550292581922.zip gcc-41c9120baf04bf432d39a11298f2550292581922.tar.gz gcc-41c9120baf04bf432d39a11298f2550292581922.tar.bz2 |
patch from paul eggert to fix -0.0/0.0 confusion that breaks glibc
* real.h (REAL_VALUES_IDENTICAL): New macro.
* expr.c (is_zeros_p): Don't consider -0.0 to be all zeros.
* fold-const.c (operand_equal_p): Don't consider -0.0 to be
identical to 0.0.
* tree.c (simple_cst_equal): Don't consider -0.0 to have the
same tree structure as 0.0.
* varasm.c (immed_real_const_1): Use new REAL_VALUES_IDENTICAL
macro instead of doing it by hand.
From-SVN: r16472
Diffstat (limited to 'gcc/real.h')
-rw-r--r-- | gcc/real.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -294,6 +294,13 @@ do { REAL_VALUE_TYPE in = (IN); /* Make sure it's not in a register. */\ #define REAL_VALUE_TO_TARGET_LONG_DOUBLE(a, b) REAL_VALUE_TO_TARGET_DOUBLE (a, b) #endif +/* Compare two floating-point objects for bitwise identity. + This is not the same as comparing for equality on IEEE hosts: + -0.0 equals 0.0 but they are not identical, and conversely + two NaNs might be identical but they cannot be equal. */ +#define REAL_VALUES_IDENTICAL(x, y) \ + (!bcmp ((char *) &(x), (char *) &(y), sizeof (REAL_VALUE_TYPE))) + /* Compare two floating-point values for equality. */ #ifndef REAL_VALUES_EQUAL #define REAL_VALUES_EQUAL(x, y) ((x) == (y)) |