mibintc added inline comments.

================
Comment at: clang/lib/AST/ExprConstant.cpp:13197-13198
   assert(E->isRValue() && E->getType()->isRealFloatingType());
+  if (Info.isStrictFP)
+    return false;
   return FloatExprEvaluator(Info, Result).Visit(E);
----------------
rsmith wrote:
> I think we should be able to evaluate (for example) `constexpr float f = 
> 1.0f;` even in a strict FP context. I think only floating point operations 
> that depend on the rounding mode should be disabled, not all floating-point 
> evaluation. Perhaps we should propagate the `FPOptions` into 
> `handleFloatFloatBinOp` and perform the check there, along with any other 
> places that care (I think we probably have some builtins that we can 
> constant-evaluate that care about rounding modes.)
> 
> You also need to produce a diagnostic when you treat an expression as 
> non-constant -- please read the comment at the top of the file for details.
> I think we should be able to evaluate (for example) `constexpr float f = 
> 1.0f;` even in a strict FP context. I think only floating point operations 
> that depend on the rounding mode should be disabled, not all floating-point 
> evaluation. Perhaps we should propagate the `FPOptions` into 
> `handleFloatFloatBinOp` and perform the check there, along with any other 
> places that care (I think we probably have some builtins that we can 
> constant-evaluate that care about rounding modes.)
> 
> You also need to produce a diagnostic when you treat an expression as 
> non-constant -- please read the comment at the top of the file for details.

It's not just rounding mode, right? If fp exceptions are unmasked then we 
should inhibit the folding in particular cases?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87528/new/

https://reviews.llvm.org/D87528

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to