public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103883] New: Signaling NaN is not handled correctly on typedef'd floating-point type Date: Fri, 31 Dec 2021 18:20:51 +0000 [thread overview] Message-ID: <bug-103883-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103883 Bug ID: 103883 Summary: Signaling NaN is not handled correctly on typedef'd floating-point type Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: fxcoudert at gcc dot gnu.org Target Milestone: --- Take this code: #include <stdint.h> #include <stdio.h> typedef double GFC_REAL_8; GFC_REAL_8 foo (void) { return __builtin_nans(""); } double bar (void) { return __builtin_nans(""); } int main (void) { double x; x = __builtin_nans (""); printf("==> %lX\n", *(uint64_t *) &x); x = foo (); printf("==> %lX\n", *(uint64_t *) &x); x = bar (); printf("==> %lX\n", *(uint64_t *) &x); } Compiling this with GCC: ==> 7FF4000000000000 ==> 7FF8000000000000 ==> 7FF4000000000000 That is, the first and third calls returns a signalling nan, but the second one returns a quiet nan. -fsignaling-nans fixes the issue, but I do not believe it should be necessary here. There is no floating-point operation being performed. See also: Joseph discussion of this issue at https://gcc.gnu.org/pipermail/gcc/2021-December/237977.html
reply other threads:[~2021-12-31 18:20 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-103883-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).