[PATCH] D87528: Enable '#pragma STDC FENV_ACCESS' in frontend cf. D69272 - Work in Progress

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 15:41:50 PDT 2020


rsmith added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2445
+       FPO.getFPExceptionMode() != LangOptions::FPE_Ignore ||
+       FPO.getAllowFEnvAccess()) && Info.Ctx.getLangOpts().CPlusPlus) {
+    Info.FFDiag(E, diag::note_constexpr_float_arithmetic_strict);
----------------
I don't think we need the `CPlusPlus` check here; we bail out of this function in constant contexts in all language modes, and in non-constant contexts we want to abort evaluation under this condition in C too.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2496-2498
+  if (llvm::APFloatBase::opOK != Result.convertFromAPInt(Value,
+                                   Value.isSigned(),
+                                   APFloat::rmNearestTiesToEven) &&
----------------
Following D89360, we should skip this check if `Info.InConstantContext`.


================
Comment at: clang/lib/AST/ExprConstant.cpp:12302
+    llvm::APFloatBase::cmpResult CmpResult = LHS.compare(RHS);
+    if (CmpResult == APFloat::cmpUnordered &&
+        E->getFPFeaturesInEffect(Info.Ctx.getLangOpts()).isFPConstrained()) {
----------------
Skip this check if `Info.InConstantContext`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87528



More information about the cfe-commits mailing list