public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/98420] New: Invalid simplification of x - x with -frounding-math Date: Tue, 22 Dec 2020 14:56:35 +0000 [thread overview] Message-ID: <bug-98420-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98420 Bug ID: 98420 Summary: Invalid simplification of x - x with -frounding-math Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com Target Milestone: --- Split out from PR96793, where Marc says in c13: -q- x-x does depend on the rounding mode (the transformation in match.pd gets it wrong, by the way). -/q- The testcase: --cut here-- #include <fenv.h> double __attribute__((noinline)) foo (double a) { return a - a; } int main () { double res; fesetround (FE_DOWNWARD); res = foo (1.11); if (__builtin_signbit (res) == 0) __builtin_abort (); return 0; } --cut here-- aborts with -O2 -ffinite-math-only -frounding-math Please note that x - x with FE_DOWNWARD should result in -0.0. The problem is in match.pd, where: (simplify (minus @0 @0) (if (!FLOAT_TYPE_P (type) || !HONOR_NANS (type)) { build_zero_cst (type); })) should involve flag_rounding_math in some way.
next reply other threads:[~2020-12-22 14:56 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-22 14:56 ubizjak at gmail dot com [this message] 2021-01-05 9:39 ` [Bug middle-end/98420] " rguenth at gcc dot gnu.org 2021-12-13 5:42 ` pinskia at gcc dot gnu.org 2022-03-10 23:56 ` roger at nextmovesoftware dot com 2022-03-12 9:23 ` cvs-commit at gcc dot gnu.org 2022-03-14 18:39 ` roger at nextmovesoftware dot com
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-98420-4@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: linkBe 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).