Fix the clang-on-clang build: APFloat reports underflow whenever we get a

denormal, but we only want to diagnose if we underflowed to zero.  This
allows people to write constants in the denormal range.

llvm-svn: 92129
This commit is contained in:
John McCall
2009-12-24 11:09:08 +00:00
parent 0e21fccfae
commit 122c8313ff

View File

@@ -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) {