public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vstinner at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/104389] New: HUGE_VAL * 0.0 is no longer a NaN Date: Fri, 04 Feb 2022 19:02:17 +0000 [thread overview] Message-ID: <bug-104389-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104389 Bug ID: 104389 Summary: HUGE_VAL * 0.0 is no longer a NaN Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: vstinner at redhat dot com Target Milestone: --- Created attachment 52352 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52352&action=edit Reproducer: huge_val_0_nan.c The Python project uses "HUGE_VAL * 0" to get a Not-a-Number (NaN) double value. Pseudo-code: #define Py_NAN (Py_HUGE_VAL * 0.) double my_nan(void) { return Py_NAN; } Until Fedora gcc-12.0.1-0.4.fc36.x86_64 (03182470d2d2b272f06500184acab6b8ed78d8ad), it worked well. With Fedora gcc-12.0.1-0.5.fc36.x86_64 (fb6057a2be99e071993fb54a5d338ab0febba8ff), my_nan() now returns zero (0.0). Try attached huge_val_0_nan.c. gcc-12.0.1-0.5.fc36.x86_64 output: --- (1) Compute HUGE_VAL * 0 in the C compiler isnan? 0 bytes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] (2) Compute HUGE_VAL * 0 at runtime isnan? 1 bytes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfffffff8, 0xffffffff] --- gcc-11.2.1-7.fc35.x86_64 output: --- (1) Compute HUGE_VAL * 0 in the C compiler isnan? 1 bytes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfffffff8, 0x7f] (2) Compute HUGE_VAL * 0 at runtime isnan? 1 bytes: [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfffffff8, 0xffffffff] --- In Python, Py_NAN is defined as "#define Py_NAN (Py_HUGE_VAL * 0.)" at: https://github.com/python/cpython/blob/bf95ff91f2c1fc5a57190491f9ccdc63458b089e/Include/pymath.h#L60 FYI diff of the Fedora package between -4 and -5, the most important part if the Git commit which changed ;-) https://src.fedoraproject.org/rpms/gcc/c/398138b5f3809856b98eb4241b3c9f70da3fce9b?branch=rawhide
next reply other threads:[~2022-02-04 19:02 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-04 19:02 vstinner at redhat dot com [this message] 2022-02-04 19:15 ` [Bug c/104389] [10/11/12 Regression] " jakub at gcc dot gnu.org 2022-02-04 19:19 ` jakub at gcc dot gnu.org 2022-02-04 19:22 ` jakub at gcc dot gnu.org 2022-02-04 19:26 ` jakub at gcc dot gnu.org 2022-02-04 19:43 ` [Bug tree-optimization/104389] " jakub at gcc dot gnu.org 2022-02-04 22:28 ` glisse at gcc dot gnu.org 2022-02-05 9:54 ` cvs-commit at gcc dot gnu.org 2022-02-05 10:22 ` [Bug tree-optimization/104389] [12 " jakub at gcc dot gnu.org 2022-02-07 7:15 ` xry111 at mengyan1223 dot wang
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-104389-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).