[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 30 10:39:47 PDT 2022


efriedma added a comment.

> setRoundingMode definitely should not call getAllowFEnvAccess() and it does not

Yes, it does?

  // C2x: 7.6.2p3  If the FE_DYNAMIC mode is specified and FENV_ACCESS is "off",
  // the translator may assume that the default rounding mode is in effect.
  if (FPR == llvm::RoundingMode::Dynamic &&
      !CurFPFeatures.getAllowFEnvAccess() &&
      CurFPFeatures.getFPExceptionMode() == LangOptions::FPE_Ignore)
    FPR = llvm::RoundingMode::NearestTiesToEven;



> As for ActOnPragmaFEnvAccess, it make sense to set the most general mode.

Shouldn't the default mode just be "dynamic"?  The fact that we emit non-strict floating-point ops if FENV_ACCESS is disabled is an implementation detail.  I don't see the point of switching the rounding mode between "Dynamic" and "NearestTiesToEven" depending on whether FENV_ACCESS is enabled.  Making the required state transitions complicated like this just makes the code harder to understand.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126364



More information about the cfe-commits mailing list