[llvm] r217295 - 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.
Nick Lewycky
nicholas at mxc.ca
Fri Sep 5 18:16:42 PDT 2014
Author: nicholas
Date: Fri Sep 5 20:16:42 2014
New Revision: 217295
URL: http://llvm.org/viewvc/llvm-project?rev=217295&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Support/APFloat.cpp
Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=217295&r1=217294&r2=217295&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Fri Sep 5 20:16:42 2014
@@ -212,15 +212,15 @@ skipLeadingZeroesAndAnyDot(StringRef::it
{
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++;
}
More information about the llvm-commits
mailing list