diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-07-02 15:50:05 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-07-02 15:50:05 +0000 |
commit | 94d6195fdf153d0b62f744544cde2d339d2d05da (patch) | |
tree | ae7851fdedde0603680f8ce17020b8ad76ef94c8 /llvm/lib/Support/APFloat.cpp | |
parent | 64e1af8eb9b4a3e6e1d34b7740031d1c7831d176 (diff) | |
download | bcm5719-llvm-94d6195fdf153d0b62f744544cde2d339d2d05da.tar.gz bcm5719-llvm-94d6195fdf153d0b62f744544cde2d339d2d05da.zip |
[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.
llvm-svn: 185437
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index ae4a101feba..8713ede6a17 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/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; |