[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 4 10:42:30 PST 2024
================
@@ -13044,9 +13044,12 @@ static QualType checkArithmeticOrEnumeralCompare(Sema &S, ExprResult &LHS,
if (Type->isAnyComplexType() && BinaryOperator::isRelationalOp(Opc))
return S.InvalidOperands(Loc, LHS, RHS);
- // Check for comparisons of floating point operands using != and ==.
- if (Type->hasFloatingRepresentation())
+ if (Type->hasFloatingRepresentation()) {
+ // Check for comparisons to NAN or INFINITY in fast math mode.
+ S.CheckInfNaNFloatComparison(Loc, LHS.get(), RHS.get(), Opc);
----------------
andykaylor wrote:
Should this be done in CheckFloatComparison()?
https://github.com/llvm/llvm-project/pull/76873
More information about the cfe-commits
mailing list