================
@@ -2922,7 +2922,7 @@ static bool handleFloatFloatBinOp(EvalInfo &Info, const 
BinaryOperator *E,
   //   If during the evaluation of an expression, the result is not
   //   mathematically defined [...], the behavior is undefined.
   // FIXME: C++ rules require us to not conform to IEEE 754 here.
-  if (LHS.isNaN()) {
+  if (!Info.getLangOpts().CPlusPlus23 && LHS.isNaN()) {
----------------
zahiraam wrote:

Not sure. We land here when the constexpr builtin_* is using a `NAN` argument 
with a Windows definition which is:
`#define INFINITY ((float)(1e+300 * 1e+300))`
`#define NAN      (-(float)(INFINITY * 0.0F))`

and an` EvalMode= EM_ConstantExpression`. 

`float f1 = __builtin_fminf(NAN, NAN);` returns an `EvaluateFloat() = true` 
(`EvalMode= EM_IgnoreSideEffects`)
`constexpr float f1 = __builtin_fminf(NAN, NAN);` returns an `EvaluateFloat() = 
false` (` EvalMode= EM_ConstantExpression`).

May be this is not the right place to do that? Should 
`keepEvaluatingAfterUndefinedBehavior` return true for C++23 when `EvalMode= 
EM_ConstantExpression`? 



https://github.com/llvm/llvm-project/pull/88978
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to