summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-29 01:24:38 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-29 01:24:38 +0000
commit314b93ea9a11200b8b5480588f38d406cdb8d741 (patch)
treeee36e0c8644cd166844d2e15df7eac1226e2f595 /gcc/real.c
parent5d5118741659a882c69d78d3fd977d7078f18294 (diff)
downloadgcc-314b93ea9a11200b8b5480588f38d406cdb8d741.tar.gz
PR c/21720
* real.c (real_from_string): Set last bit if there is a nonzero hex digit beyond GCC's internal precision. testsuite: * gcc.dg/hex-round-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102539 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/real.c b/gcc/real.c
index 9099f410f8d..045a803a594 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1789,6 +1789,10 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str)
|= (unsigned long) d << (pos % HOST_BITS_PER_LONG);
pos -= 4;
}
+ else if (d)
+ /* Ensure correct rounding by setting last bit if there is
+ a subsequent nonzero digit. */
+ r->sig[0] |= 1;
exp += 4;
str++;
}