public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/102129] -ftrapping-math is broken or badly documented
Date: Mon, 30 Aug 2021 19:49:53 +0000	[thread overview]
Message-ID: <bug-102129-4-omdYiLEfri@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102129-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102129

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Mon, 30 Aug 2021, vincent-gcc at vinc17 dot net via Gcc-bugs wrote:

> In the generated code with -O1 and above, one can see that the multiplication
> is done after g is called, even if -ftrapping-math is used (which is the
> default). This is incorrect as x * 5.0 may trap, terminating the program with a
> floating-point exception, in which case g must not be executed.

It's incorrect as the function g might call fetestexcept and examine the 
floating-point exception flags raised, or feclearexcept to clear them.  
That has nothing to do with trap enablement.  Since trap enablement is 
outside the scope of ISO C, and since various processors implement aspects 
of it differently making it inherently unportable, issues that appear 
without involving enabled traps are best considered without involving such 
traps at all.

  parent reply	other threads:[~2021-08-30 19:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 14:32 [Bug middle-end/102129] New: " vincent-gcc at vinc17 dot net
2021-08-30 15:00 ` [Bug middle-end/102129] " vincent-gcc at vinc17 dot net
2021-08-30 19:49 ` joseph at codesourcery dot com [this message]
2021-08-31  0:37 ` vincent-gcc at vinc17 dot net
2021-08-31  7:12 ` rguenth at gcc dot gnu.org
2021-08-31  7:18 ` rguenth at gcc dot gnu.org
2021-08-31  8:25 ` rguenth at gcc dot gnu.org
2021-08-31  8:26 ` rguenth at gcc dot gnu.org
2021-08-31  8:49 ` rguenth at gcc dot gnu.org
2021-08-31  9:38 ` cvs-commit at gcc dot gnu.org
2021-08-31  9:38 ` rguenth at gcc dot gnu.org

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=bug-102129-4-omdYiLEfri@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).