denormal, but we only want to diagnose if we underflowed to zero. This
allows people to write constants in the denormal range.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92129
91177308-0d34-0410-b5e6-
96231b3b80d8
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) {