public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions
@ 2006-10-05  3:37 sjc at pobox dot com
  2007-03-28  9:48 ` [Bug math/3306] " jakub at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: sjc at pobox dot com @ 2006-10-05  3:37 UTC (permalink / raw)
  To: glibc-bugs

The man page for "nextafter" and "nextafterf" states that they will signal 
overflow and underflow if the result is not a normalized number (and I believe
they should signal "inexact" as well, based on section F.9.8.3 of ISO/IEC
9899:TC2, the "C99" standard.) On an X8664 architecture with the -m64 option the
functions do so, but with the -m32 option they do not. I reproduced this on
various versions of Fedora Core OS with both gcc 3 and gcc 4, so it appears to
be a longstanding problem:

-bash-3.1$  cat csjc.c
#include <stdio.h>
#include <math.h>
#include <fenv.h>

int main(int argc, char **argv) {
  float x, s, y;
  * ((unsigned *) &x) = 0x00800000;
  s = 0.0;
  feclearexcept(FE_ALL_EXCEPT);
  y = nextafterf(x, s);
  unsigned i = fetestexcept(FE_ALL_EXCEPT);
  printf("nextafterf: %x\n", * ((unsigned *) &y));
  printf("fetestexcept: %x\n", i);
  printf("FE_UNDERFLOW: %x\n", FE_UNDERFLOW);
  printf("FE_INEXACT: %x\n", FE_INEXACT);
  return 0;
  }
-bash-3.1$ gcc -v -save-temps -o csjc.m32 -m32 csjc.c -lm
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1 -E -quiet -v csjc.c -m32
-mtune=generic -fpch-preprocess -o csjc.i
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include
 /usr/include
End of search list.
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1 -fpreprocessed csjc.i -quiet
-dumpbase csjc.c -m32 -mtune=generic -auxbase csjc -version -o csjc.s
GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 990baec469b77ffbcfce8c2c8d27c0bf
 as -V -Qy --32 -o csjc.o csjc.s
GNU assembler version 2.16.91.0.6 (x86_64-redhat-linux) using BFD version
2.16.91.0.6 20060212
 /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o csjc.m32
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib csjc.o -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/4.1.1/../../../../lib/crtn.o
-bash-3.1$ gcc -o csjc.m64 -m64 csjc.c -lm
-bash-3.1$ ./csjc.m32
nextafterf: 7fffff
fetestexcept: 0
FE_UNDERFLOW: 10
FE_INEXACT: 20
-bash-3.1$ ./csjc.m64
nextafterf: 7fffff
fetestexcept: 30
FE_UNDERFLOW: 10
FE_INEXACT: 20

-- 
           Summary: nextafter and nextafterf fail to raise IEEE exceptions
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: sjc at pobox dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
  2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
@ 2007-03-28  9:48 ` jakub at redhat dot com
  2007-07-12 15:08 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2007-03-28  9:48 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-03-28 10:48 -------
http://sources.redhat.com/ml/libc-hacker/2007-03/msg00038.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|aj at suse dot de           |jakub at redhat dot com
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
  2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
  2007-03-28  9:48 ` [Bug math/3306] " jakub at redhat dot com
@ 2007-07-12 15:08 ` cvs-commit at gcc dot gnu dot org
  2008-05-05 20:22 ` aurelien at aurel32 dot net
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2007-07-12 15:08 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2007-07-12 15:08 -------
Subject: Bug 3306

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_5-branch
Changes by:	jakub@sourceware.org	2007-07-12 15:08:18

Modified files:
	.              : ChangeLog 
	math           : bug-nextafter.c bug-nexttoward.c math_private.h 
	                 s_nextafter.c s_nexttowardf.c 
	sysdeps/i386/fpu: s_nextafterl.c s_nexttoward.c s_nexttowardf.c 
	sysdeps/ieee754/flt-32: s_nextafterf.c 
	sysdeps/ieee754/ldbl-128: s_nextafterl.c s_nexttoward.c 
	sysdeps/ieee754/ldbl-128ibm: s_nextafterl.c s_nexttoward.c 
	                             s_nexttowardf.c 
	sysdeps/ieee754/ldbl-96: s_nextafterl.c s_nexttoward.c 
	                         s_nexttowardf.c 
	sysdeps/ieee754/ldbl-opt: s_nexttowardfd.c 
Added files:
	sysdeps/i386/fpu: math_private.h 
	sysdeps/x86_64/fpu: math_private.h 

Log message:
	2007-04-01  Jakub Jelinek  <jakub@redhat.com>
	
	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Use
	math_opt_barrier and math_force_eval macros.
	
	2007-03-27  Jakub Jelinek  <jakub@redhat.com>
	
	[BZ #3306]
	* math/math_private.h (math_opt_barrier, math_force_eval): Define.
	* sysdeps/i386/fpu/math_private.h: New file.
	* sysdeps/x86_64/fpu/math_private.h: New file.
	* math/s_nexttowardf.c (__nexttowardf): Use math_opt_barrier and
	math_force_eval macros.  Use "+m" constraint on asm rather than
	"=m" and "m".
	* math/s_nextafter.c (__nextafter): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward):
	Likewise.
	* sysdeps/ieee754/flt-32/s_nextafterf.c (__nextafterf): Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Use
	math_opt_barrier and math_force_eval macros.
	* sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_nextafterl.c (__nextafterl): Likewise.
	* sysdeps/i386/fpu/s_nexttoward.c: Include float.h.
	(__nexttoward): Use math_opt_barrier and
	math_force_eval macros.  Use "+m" constraint on asm rather than
	"=m" and "m".  Only use asm to force double result if
	FLT_EVAL_METHOD is 2.
	* sysdeps/i386/fpu/s_nexttowardf.c: Include float.h.
	(__nexttowardf): Use math_opt_barrier and
	math_force_eval macros.  Use "+m" constraint on asm rather than
	"=m" and "m".  Only use asm to force double result if
	FLT_EVAL_METHOD is not 0.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include float.h.
	(__nexttowardf): Use math_opt_barrier and
	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
	x to float using asm.
	* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include float.h.
	(__nldbl_nexttowardf): Use math_opt_barrier and
	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
	x to float using asm.
	* sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include float.h.
	(__nexttowardf): Use math_opt_barrier and math_force_eval
	macros.  If FLT_EVAL_METHOD is not 0, force x to float using asm.
	* math/bug-nextafter.c (zero, inf): New variables.
	(main): Add new tests.
	* math/bug-nexttoward.c (zero, inf): New variables.
	(main): Add new tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.10362.2.60&r2=1.10362.2.61
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/math/bug-nextafter.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.3&r2=1.3.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/math/bug-nexttoward.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/math/math_private.h.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.20&r2=1.20.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/math/s_nextafter.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/math/s_nexttowardf.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/fpu/math_private.h.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=NONE&r2=1.1.6.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/fpu/s_nextafterl.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.11&r2=1.11.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/fpu/s_nexttoward.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.2&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/fpu/s_nexttowardf.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.2&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/flt-32/s_nextafterf.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.3&r2=1.3.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-128/s_nextafterl.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.10.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.3&r2=1.3.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-96/s_nextafterl.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.3&r2=1.3.10.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.6&r2=1.6.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-96/s_nexttowardf.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.2&r2=1.2.10.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/x86_64/fpu/math_private.h.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=NONE&r2=1.1.6.1



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
  2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
  2007-03-28  9:48 ` [Bug math/3306] " jakub at redhat dot com
  2007-07-12 15:08 ` cvs-commit at gcc dot gnu dot org
@ 2008-05-05 20:22 ` aurelien at aurel32 dot net
  2008-05-05 20:22 ` aurelien at aurel32 dot net
  2009-05-07 15:34 ` aurelien at aurel32 dot net
  4 siblings, 0 replies; 7+ messages in thread
From: aurelien at aurel32 dot net @ 2008-05-05 20:22 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aurelien at aurel32 dot net  2008-05-05 20:21 -------
One filed has been missed in this commit, causing failures in the testsuite on 
s390 when built with gcc 4.3: 

sysdeps/ieee754/ldbl-128/s_nexttowardf.c

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
  2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
                   ` (2 preceding siblings ...)
  2008-05-05 20:22 ` aurelien at aurel32 dot net
@ 2008-05-05 20:22 ` aurelien at aurel32 dot net
  2009-05-07 15:34 ` aurelien at aurel32 dot net
  4 siblings, 0 replies; 7+ messages in thread
From: aurelien at aurel32 dot net @ 2008-05-05 20:22 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aurelien at aurel32 dot net  2008-05-05 20:22 -------
Created an attachment (id=2721)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2721&action=view)
Patch to fix the problem.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
  2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
                   ` (3 preceding siblings ...)
  2008-05-05 20:22 ` aurelien at aurel32 dot net
@ 2009-05-07 15:34 ` aurelien at aurel32 dot net
  4 siblings, 0 replies; 7+ messages in thread
From: aurelien at aurel32 dot net @ 2009-05-07 15:34 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From aurelien at aurel32 dot net  2009-05-07 15:33 -------
Any news on that?

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3306

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug math/3306] nextafter and nextafterf fail to raise IEEE exceptions
       [not found] <bug-3306-131@http.sourceware.org/bugzilla/>
@ 2012-02-28 16:45 ` jsm28 at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-28 16:45 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=3306

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Joseph Myers <jsm28 at gcc dot gnu.org> 2012-02-28 16:45:13 UTC ---
It appears the final case of this was fixed by the commit:

commit 64f388285e11812f041d3aa8347f82efde4033c1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jan 16 17:55:37 2010 -0800

    sysdeps/ieee754/ldbl-128/ fixes

(the rest having been fixed in 2007).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-02-28 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-05  3:37 [Bug math/3306] New: nextafter and nextafterf fail to raise IEEE exceptions sjc at pobox dot com
2007-03-28  9:48 ` [Bug math/3306] " jakub at redhat dot com
2007-07-12 15:08 ` cvs-commit at gcc dot gnu dot org
2008-05-05 20:22 ` aurelien at aurel32 dot net
2008-05-05 20:22 ` aurelien at aurel32 dot net
2009-05-07 15:34 ` aurelien at aurel32 dot net
     [not found] <bug-3306-131@http.sourceware.org/bugzilla/>
2012-02-28 16:45 ` jsm28 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).