public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/103883] New: Signaling NaN is not handled correctly on typedef'd floating-point type
@ 2021-12-31 18:20 fxcoudert at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-31 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-31 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 18:20 [Bug middle-end/103883] New: Signaling NaN is not handled correctly on typedef'd floating-point type fxcoudert at gcc dot gnu.org

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).