diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-16 16:34:05 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-16 16:34:05 +0000 |
commit | f2ecae0888724b127e4110d52908a2f4938590cb (patch) | |
tree | a2a57c56bccf00dd8cdef7eec61b9feab32f21c8 /gcc/real.c | |
parent | dc44b957fb24d4e3581e40788fec69b5f4f4b9bc (diff) | |
download | gcc-f2ecae0888724b127e4110d52908a2f4938590cb.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112136 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/real.c b/gcc/real.c index c4b6479067f..1e1083f9abe 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -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; |