diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-03-16 16:34:05 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-03-16 16:34:05 +0000 |
commit | a47564c87c482e932230f440463c9c1a962e66d8 (patch) | |
tree | a2a57c56bccf00dd8cdef7eec61b9feab32f21c8 /gcc/real.c | |
parent | 349f4ea14a4b563b86ef48a3f4dde6643ae91226 (diff) | |
download | gcc-a47564c87c482e932230f440463c9c1a962e66d8.zip gcc-a47564c87c482e932230f440463c9c1a962e66d8.tar.gz gcc-a47564c87c482e932230f440463c9c1a962e66d8.tar.bz2 |
re PR middle-end/21781 (real.c incorrectly values zero with a large exponent)
PR middle-end/21781
* real.c (real_from_string): If the mantissa is zero, don't bother
parsing the exponent as the result should always be zero.
* gcc.dg/real-const-1.c: New test case.
From-SVN: r112136
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1862,6 +1862,11 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) str++; } } + + /* If the mantissa is zero, ignore the exponent. */ + if (!cmp_significand_0 (r)) + goto underflow; + if (*str == 'p' || *str == 'P') { bool exp_neg = false; @@ -1934,6 +1939,10 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) } } + /* If the mantissa is zero, ignore the exponent. */ + if (r->cl == rvc_zero) + goto underflow; + if (*str == 'e' || *str == 'E') { bool exp_neg = false; |