diff options
author | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-02-06 21:01:46 +0000 |
---|---|---|
committer | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-02-06 21:01:46 +0000 |
commit | 42dc1cf56b3a09aa5a6b62796bc203d2d0b4fb8e (patch) | |
tree | 48c2fa1417f3cc8b1103a20746052eb2deaa3219 /gcc/real.c | |
parent | 82f917e7169495dd5d2d789b87d5499c4ddb2c4f (diff) | |
download | gcc-42dc1cf56b3a09aa5a6b62796bc203d2d0b4fb8e.tar.gz |
PR c/39035
* real.c (do_compare): Special-case compare of zero against
decimal float value.
* gcc.dg/dfp/pr39035.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143992 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/real.c b/gcc/real.c index d26b0cbd0c9..29fee8305e1 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -905,15 +905,23 @@ do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b, /* Sign of zero doesn't matter for compares. */ return 0; + case CLASS2 (rvc_normal, rvc_zero): + /* Decimal float zero is special and uses rvc_normal, not rvc_zero. */ + if (a->decimal) + return decimal_do_compare (a, b, nan_result); + /* Fall through. */ case CLASS2 (rvc_inf, rvc_zero): case CLASS2 (rvc_inf, rvc_normal): - case CLASS2 (rvc_normal, rvc_zero): return (a->sign ? -1 : 1); case CLASS2 (rvc_inf, rvc_inf): return -a->sign - -b->sign; case CLASS2 (rvc_zero, rvc_normal): + /* Decimal float zero is special and uses rvc_normal, not rvc_zero. */ + if (b->decimal) + return decimal_do_compare (a, b, nan_result); + /* Fall through. */ case CLASS2 (rvc_zero, rvc_inf): case CLASS2 (rvc_normal, rvc_inf): return (b->sign ? 1 : -1); |