summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 3ebed5b5ab8..208950d7ab7 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -198,7 +198,10 @@ readExponent(StringRef::iterator begin, StringRef::iterator end)
const unsigned int overlargeExponent = 24000; /* FIXME. */
StringRef::iterator p = begin;
- assert(p != end && "Exponent has no digits");
+ // Treat no exponent as 0 to match binutils
+ if (p == end || ((*p == '-' || *p == '+') && (p + 1) == end)) {
+ return 0;
+ }
isNegative = (*p == '-');
if (*p == '-' || *p == '+') {
OpenPOWER on IntegriCloud