aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gottesman <mgottesman@apple.com>2013-07-02 15:50:05 +0000
committerMichael Gottesman <mgottesman@apple.com>2013-07-02 15:50:05 +0000
commitc93bee09ac0ebfad4efd7a7d195ce586d9ad50ed (patch)
tree4a0b16bc119707067812187e68f943aaa37a4e63
parenta3863ea2dacafc925a8272ebf9884fc64bef686c (diff)
downloadexternal_llvm-c93bee09ac0ebfad4efd7a7d195ce586d9ad50ed.zip
external_llvm-c93bee09ac0ebfad4efd7a7d195ce586d9ad50ed.tar.gz
external_llvm-c93bee09ac0ebfad4efd7a7d195ce586d9ad50ed.tar.bz2
[APFloat] Swap an early out check so we do not dereference str.end().
Originally if D.firstSigDigit == str.end(), we will have already dereferenced D.firstSigDigit in the first predicate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185437 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/APFloat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index ae4a101..8713ede 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -2488,7 +2488,7 @@ APFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode)
// D->firstSigDigit equals str.end(), every digit must be a zero and there can
// be at most one dot. On the other hand, if we have a zero with a non-zero
// exponent, then we know that D.firstSigDigit will be non-numeric.
- if (decDigitValue(*D.firstSigDigit) >= 10U || D.firstSigDigit == str.end()) {
+ if (D.firstSigDigit == str.end() || decDigitValue(*D.firstSigDigit) >= 10U) {
category = fcZero;
fs = opOK;