mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user