[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)
Zahira Ammarguellat via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 5 13:57:33 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);
----------------
zahiraam wrote:
Done.
https://github.com/llvm/llvm-project/pull/76873
More information about the cfe-commits
mailing list