summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-09-06 01:16:42 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-09-06 01:16:42 +0000
commit095b92e51b2fd06926549fbcfccc9ee2a31a18c7 (patch)
tree9f190c0422dbbff08b78a35affb3b5deb867f0e9 /llvm/lib/Support/APFloat.cpp
parentba1ecbc7d399a77b490583c24c8ba658a84b55b8 (diff)
downloadbcm5719-llvm-095b92e51b2fd06926549fbcfccc9ee2a31a18c7.tar.gz
bcm5719-llvm-095b92e51b2fd06926549fbcfccc9ee2a31a18c7.zip
Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test.
llvm-svn: 217295
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 097986d3e7c..659914a85f5 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -212,15 +212,15 @@ skipLeadingZeroesAndAnyDot(StringRef::iterator begin, StringRef::iterator end,
{
StringRef::iterator p = begin;
*dot = end;
- while (*p == '0' && p != end)
+ while (p != end && *p == '0')
p++;
- if (*p == '.') {
+ if (p != end && *p == '.') {
*dot = p++;
assert(end - begin != 1 && "Significand has no digits");
- while (*p == '0' && p != end)
+ while (p != end && *p == '0')
p++;
}
OpenPOWER on IntegriCloud