[PATCH] D88498: [FPEnv] Evaluate initializers in constant rounding mode

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 17:08:53 PDT 2020


rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.

In D88498#2329845 <https://reviews.llvm.org/D88498#2329845>, @sepavloff wrote:

> - Reverted check to the previous version, in which it applied to C++ file level variables also.

This presumably reintroduces the misbehavior for

  double d;
  double e = (fesetround(...), d = some calculation, fesetround(...default...), d);

in which `some calculation` will be treated as being in the default rounding mode, right?

> - Added workaround for constexpr functions. Now they are parsed with constant rounding mode, which allows to use them with option `-frounding-math`.

This is inappropriate. When a `constexpr` function is invoked at runtime, it should behave exactly like any other function. Marking a function as `constexpr` should not cause it to round differently when used outside of constant expressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88498



More information about the cfe-commits mailing list