[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-08 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Zahira Ammarguellat (zahiraam) Changes Check for comparisons to INF and NaN when in ffast-math mode and generate a warning. --- Full diff: https://github.com/llvm/llvm-project/pull/76873.diff 5 Files Affected: - (modified)

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-08 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam ready_for_review https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > Expanding the scope a bit, it would also be useful to have warnings for > constant NaN or Inf values passed as arguments or used in binary operations. Added that. https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
@@ -13044,9 +13044,12 @@ static QualType checkArithmeticOrEnumeralCompare(Sema , ExprResult , if (Type->isAnyComplexType() && BinaryOperator::isRelationalOp(Opc)) return S.InvalidOperands(Loc, LHS, RHS); - // Check for comparisons of floating point operands using !=

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
@@ -2267,6 +2273,16 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_signbit: case Builtin::BI__builtin_signbitf: case Builtin::BI__builtin_signbitl: +FPO = TheCall->getFPFeaturesInEffect(getLangOpts());

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/76873 >From 7dbaf037b6b2196cee7c0c837e0a89ce3c2556ed Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 3 Jan 2024 14:37:17 -0800 Subject: [PATCH 1/2] [CLANG] Add warning when comparing to INF or NAN in fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13044,9 +13044,12 @@ static QualType checkArithmeticOrEnumeralCompare(Sema , ExprResult , if (Type->isAnyComplexType() && BinaryOperator::isRelationalOp(Opc)) return S.InvalidOperands(Loc, LHS, RHS); - // Check for comparisons of floating point operands using !=

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -2267,6 +2273,16 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_signbit: case Builtin::BI__builtin_signbitf: case Builtin::BI__builtin_signbitl: +FPO = TheCall->getFPFeaturesInEffect(getLangOpts());

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -2245,6 +2246,11 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_islessequal: case Builtin::BI__builtin_islessgreater: case Builtin::BI__builtin_isunordered: +if (BuiltinID == Builtin::BI__builtin_isunordered)

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -6771,6 +6771,9 @@ def warn_pointer_sub_null_ptr : Warning< def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, InGroup>, DefaultIgnore; +def warn_fast_floatingpoint_eq : Warning< + "explicit comparison with %0 in fast floating

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: Expanding the scope a bit, it would also be useful to have warnings for constant NaN or Inf values passed as arguments or used in binary operations. https://github.com/llvm/llvm-project/pull/76873 ___

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-03 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam edited https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-03 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam created https://github.com/llvm/llvm-project/pull/76873 None >From 7dbaf037b6b2196cee7c0c837e0a89ce3c2556ed Mon Sep 17 00:00:00 2001 From: Ammarguellat Date: Wed, 3 Jan 2024 14:37:17 -0800 Subject: [PATCH] [CLANG] Add warning when comparing to INF or NAN in fast