aboutsummaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-05-14 08:53:03 +0200
committerRichard Biener <rguenther@suse.de>2020-05-14 10:50:05 +0200
commit568c985113b29574c4e25e1a016475668fc17c28 (patch)
treeaa43af854ed86890cb52ccfd025a2e46621245d5 /gcc/real.c
parent7a50e7087567cffb21e81fff566546b8a8dac270 (diff)
downloadgcc-568c985113b29574c4e25e1a016475668fc17c28.zip
gcc-568c985113b29574c4e25e1a016475668fc17c28.tar.gz
gcc-568c985113b29574c4e25e1a016475668fc17c28.tar.bz2
middle-end/95118 - fix printing of denormal zero
This fixes printing a REAL_CST generated from value-numbering punning some bits to a real which turns out as zero with big negative exponent. This causes the loop in real_to_decimal_for_mode to never terminate. 2020-05-14 Richard Biener <rguenther@suse.de> PR middle-end/95118 * real.c (real_to_decimal_for_mode): Make sure we handle a zero with nonzero exponent. * gcc.dg/pr95118.c: New testcase.
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/real.c b/gcc/real.c
index 00b23ce..09ec5c0 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1714,8 +1714,8 @@ real_to_decimal_for_mode (char *str, const REAL_VALUE_TYPE *r_orig,
do_multiply (&u, &v, ten);
- /* Stop if we're now >= 1. */
- if (REAL_EXP (&u) > 0)
+ /* Stop if we're now >= 1 or zero. */
+ if (REAL_EXP (&u) > 0 || u.cl == rvc_zero)
break;
v = u;