diff options
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 0951677db2..a6b409b99f 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1589,7 +1589,11 @@ Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) { APFloat Val(Format); APFloat::opStatus result = Literal.GetFloatValue(Val); - if (result & (APFloat::opOverflow | APFloat::opUnderflow)) { + + // Overflow is always an error, but underflow is only an error if + // we underflowed to zero (APFloat reports denormals as underflow). + if ((result & APFloat::opOverflow) || + ((result & APFloat::opUnderflow) && Val.isZero())) { unsigned diagnostic; llvm::SmallVector<char, 20> buffer; if (result & APFloat::opOverflow) { |