public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@embecosm.com>
To: gcc-patches@gcc.gnu.org
Cc: Joseph Myers <joseph@codesourcery.com>
Subject: [PATCH] doc: Clarify FENV_ACCESS pragma semantics WRT `-ftrapping-math'
Date: Tue, 19 Jul 2022 13:23:33 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.20.2207191258280.10833@tpp.orcam.me.uk> (raw)

Our documentation indicates that it is the `-frounding-math' invocation 
option that controls whether we respect what the FENV_ACCESS pragma 
would imply, should we implement it, regarding the floating point 
environment.  It is only a part of the picture however, because the 
`-ftrapping-math' invocation option also affects how we handle said 
environment.  Clarify that in the description of both options then, as 
well as the FENV_ACCESS pragma itself.

	gcc/
	* doc/implement-c.texi (Floating point implementation): Mention
	`-fno-trapping-math' in the context of FENV_ACCESS pragma.
	* doc/invoke.texi (Optimize Options): Clarify FENV_ACCESS pragma
	implication in the descriptions of `-fno-trapping-math' and 
	`-frounding-math'.
---
Hi,

 Discovered in the course of investigating RISC-V unordered comparisons, 
c.f. <https://gcc.gnu.org/pipermail/gcc-patches/2022-July/597767.html>.

  Maciej
---
 gcc/doc/implement-c.texi |    3 ++-
 gcc/doc/invoke.texi      |    8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

gcc-doc-fenv-access-trapping.diff
Index: gcc/gcc/doc/implement-c.texi
===================================================================
--- gcc.orig/gcc/doc/implement-c.texi
+++ gcc/gcc/doc/implement-c.texi
@@ -339,7 +339,8 @@ This is subject to change.
 7.6.1).}
 
 This pragma is not implemented, but the default is to ``off'' unless
-@option{-frounding-math} is used in which case it is ``on''.
+@option{-frounding-math} is used and @option{-fno-trapping-math} is not
+in which case it is ``on''.
 
 @item
 @cite{Additional floating-point exceptions, rounding modes, environments,
Index: gcc/gcc/doc/invoke.texi
===================================================================
--- gcc.orig/gcc/doc/invoke.texi
+++ gcc/gcc/doc/invoke.texi
@@ -13513,6 +13513,11 @@ math functions.
 
 The default is @option{-ftrapping-math}.
 
+Future versions of GCC may provide finer control of this setting
+using C99's @code{FENV_ACCESS} pragma.  This command-line option
+will be used along with @option{-frounding-math} to specify the
+default state for @code{FENV_ACCESS}.
+
 @item -frounding-math
 @opindex frounding-math
 Disable transformations and optimizations that assume default floating-point
@@ -13531,7 +13536,8 @@ This option is experimental and does not
 disable all GCC optimizations that are affected by rounding mode.
 Future versions of GCC may provide finer control of this setting
 using C99's @code{FENV_ACCESS} pragma.  This command-line option
-will be used to specify the default state for @code{FENV_ACCESS}.
+will be used along with @option{-ftrapping-math} to specify the
+default state for @code{FENV_ACCESS}.
 
 @item -fsignaling-nans
 @opindex fsignaling-nans

             reply	other threads:[~2022-07-19 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 12:23 Maciej W. Rozycki [this message]
2022-07-20  7:19 ` Richard Biener
2022-07-27 22:45 ` Joseph Myers
2022-07-28 13:22   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.2207191258280.10833@tpp.orcam.me.uk \
    --to=macro@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).