aboutsummaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2009-02-06 21:01:46 +0000
committerJanis Johnson <janis@gcc.gnu.org>2009-02-06 21:01:46 +0000
commit90ef229674991eae3daa1a066d4608ffe146e3ad (patch)
tree48c2fa1417f3cc8b1103a20746052eb2deaa3219 /gcc/real.c
parent4c51d57f4961ab2cab9a5772321c64cb04bf9412 (diff)
downloadgcc-90ef229674991eae3daa1a066d4608ffe146e3ad.zip
gcc-90ef229674991eae3daa1a066d4608ffe146e3ad.tar.gz
gcc-90ef229674991eae3daa1a066d4608ffe146e3ad.tar.bz2
re PR c/39035 (if( 0.0DF ) is considered true)
PR c/39035 * real.c (do_compare): Special-case compare of zero against decimal float value. * gcc.dg/dfp/pr39035.c: New test. From-SVN: r143992
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/real.c b/gcc/real.c
index d26b0cb..29fee83 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);