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

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 25 03:11:58 PDT 2022


sepavloff created this revision.
sepavloff added reviewers: aaron.ballman, andrew.w.kaylor, rjmccall, efriedma, kpn.
Herald added a project: All.
sepavloff requested review of this revision.
Herald added a project: clang.

Previously `#pragma STDC FENV_ACCESS ON` always set dynamic rounding
mode and strict exception handling. It is however too pessimistic in
many cases. In practice the pragma can be used to change rounding mode
only or to check exception flags without changing rounding mode. It
could be made by using other pragmas, `FENV_ROUND` or `clang fp
exception`, but their effect was overwritten by `FENV_ACCESS`. This
change modifies treatment of this pragma so that it sets rounding and
exception handling only if they are not set by other pragmas.

Also `#pragma STDC FENV_ACCESS OFF` turned off only FEnvAccess flag
leaving rounding mode and exception handling unchanged, which does not
make sense in many cases. The change fixes this behavior also.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126364

Files:
  clang/lib/Sema/SemaAttr.cpp
  clang/test/CodeGen/pragma-fenv_access.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126364.431927.patch
Type: text/x-patch
Size: 5756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220525/5dd62929/attachment.bin>


More information about the cfe-commits mailing list