public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/30972] New: totalorder compares quiet NaN and signalling NaN incorrectly on i386
@ 2023-10-13 20:36 bruno at clisp dot org
  2023-10-13 20:39 ` [Bug math/30972] " bruno at clisp dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2023-10-13 20:36 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30972

            Bug ID: 30972
           Summary: totalorder compares quiet NaN and signalling NaN
                    incorrectly on i386
           Product: glibc
           Version: 2.35
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

Created attachment 15168
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15168&action=edit
test case foo.c

The totalorder function is specified to compare (positive_signalling_NaN)
smaller than (positive_quiet_NaN). See
https://www.gnu.org/software/libc/manual/html_node/FP-Comparison-Functions.html
https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00037.html

With glibc 2.35 on x86 (32-bit), this does not work. Find attached a test case.

How to reproduce:
$ i686-linux-gnu-gcc -Wall foo.c -lm
$ ldd ./a.out 
        linux-gate.so.1 (0xf7ef0000)
        libm.so.6 => /lib32/libm.so.6 (0xf7dbd000)
        libc.so.6 => /lib32/libc.so.6 (0xf7b8c000)
        /lib/ld-linux.so.2 (0xf7ef2000)
$ /lib32/libc.so.6
GNU C Library (Ubuntu GLIBC 2.35-0ubuntu3.4) stable release version 2.35.
...
$ ./a.out
Failed: i=0 j=1
Failed: i=1 j=0
Failed: i=12 j=13
Failed: i=13 j=12
$ echo $?
1

Expected outcome (like e.g. on x86_64):
$ ./a.out
$ echo $?
0

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/30972] totalorder compares quiet NaN and signalling NaN incorrectly on i386
  2023-10-13 20:36 [Bug math/30972] New: totalorder compares quiet NaN and signalling NaN incorrectly on i386 bruno at clisp dot org
@ 2023-10-13 20:39 ` bruno at clisp dot org
  2023-10-13 21:17 ` bruno at clisp dot org
  2023-10-13 21:19 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2023-10-13 20:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30972

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i386-linux-gnu
               Host|                            |i386-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/30972] totalorder compares quiet NaN and signalling NaN incorrectly on i386
  2023-10-13 20:36 [Bug math/30972] New: totalorder compares quiet NaN and signalling NaN incorrectly on i386 bruno at clisp dot org
  2023-10-13 20:39 ` [Bug math/30972] " bruno at clisp dot org
@ 2023-10-13 21:17 ` bruno at clisp dot org
  2023-10-13 21:19 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2023-10-13 21:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30972

--- Comment #1 from Bruno Haible <bruno at clisp dot org> ---
Created attachment 15169
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15169&action=edit
corrected test case foo-corrected.c

When I change the signature of 'construct_signalling_nan', to return a union
instead of a 'double', as in the attached foo-corrected.c, things work.

Thus it is not a bug in the 'totalorder' function, but rather a bug in my test
case.

You can cancel this ticket. Sorry for the noise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/30972] totalorder compares quiet NaN and signalling NaN incorrectly on i386
  2023-10-13 20:36 [Bug math/30972] New: totalorder compares quiet NaN and signalling NaN incorrectly on i386 bruno at clisp dot org
  2023-10-13 20:39 ` [Bug math/30972] " bruno at clisp dot org
  2023-10-13 21:17 ` bruno at clisp dot org
@ 2023-10-13 21:19 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2023-10-13 21:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30972

Bruno Haible <bruno at clisp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Bruno Haible <bruno at clisp dot org> ---
Closing, per comment #1.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-13 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13 20:36 [Bug math/30972] New: totalorder compares quiet NaN and signalling NaN incorrectly on i386 bruno at clisp dot org
2023-10-13 20:39 ` [Bug math/30972] " bruno at clisp dot org
2023-10-13 21:17 ` bruno at clisp dot org
2023-10-13 21:19 ` bruno at clisp dot 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).