diff options
author | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-11-14 00:07:27 +0000 |
---|---|---|
committer | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-11-14 00:07:27 +0000 |
commit | 62aa7862114c21c6a4f38e4113b5ce37c435d489 (patch) | |
tree | 1ed9b899bbe18e155415baaf3f9f4beafd425fb0 /gcc/real.h | |
parent | a59e9a3a19b8ae18b9922541ebfc8cdd13858f1b (diff) | |
download | gcc-62aa7862114c21c6a4f38e4113b5ce37c435d489.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16472 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.h')
-rw-r--r-- | gcc/real.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/real.h b/gcc/real.h index 530a88659f7..a91061ef54d 100644 --- a/gcc/real.h +++ b/gcc/real.h @@ -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)) |