This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH] [PORTS] PPC fenv fixes for soft-fp
- From: Steven Munroe <munroesj at us dot ibm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, libc-ports at sources dot redhat dot com
- Cc: Glibc hackers <libc-hacker at sources dot redhat dot com>, Ulrich Drepper <drepper at redhat dot com>, Peter Eberlein <eberlein at us dot ibm dot com>
- Date: Mon, 02 Apr 2007 11:59:54 -0500
- Subject: [PATCH] [PORTS] PPC fenv fixes for soft-fp
- Organization: IBM LTC
- References: <20070322145345.GZ1826@sunsite.mff.cuni.cz> <4602FCE5.7060203@us.ibm.com> <460941B8.2050501@us.ibm.com> <20070327160708.GA355@devserv.devel.redhat.com>
This change exposes a few bugs in the soft-fp implementations for PPC.
The current feholdexcept implementation has where it uses fesetenv to
resort the current env:
/* Get the current state. */
fegetenv (envp);
u.fenv = *envp;
/* Clear everything except the rounding mode. */
u.l[0] &= 0x3;
/* ?? Should we clear the disabled exceptions as well ?? */
/* Put the new state in effect. */
fesetenv (envp);
Which is incorrect. It should disable exceptions and pass the updated
env to fesetenv:
/* Disable exceptions */
u.l[1] = FE_ALL_EXCEPT;
/* Put the new state in effect. */
fesetenv (&u.fenv);
Finally the powerpc/nofpu version is missing the libm_hidden_def which
results in a link error in make check.
The attached patch fixes all of these problems.
2007-04-02 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Disable
exceptions. Use the updated env in fesetenv().
Add libm_hidden_def.
diff -urN libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/feholdexcpt.c libc25/ports/sysdeps/powerpc/nofpu/feholdexcpt.c
--- libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/feholdexcpt.c 2002-10-19 15:06:29.000000000 -0500
+++ libc25/ports/sysdeps/powerpc/nofpu/feholdexcpt.c 2007-04-02 10:57:50.350540888 -0500
@@ -1,6 +1,6 @@
/* Store current floating-point environment and clear exceptions
(soft-float edition).
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2007 Free Software Foundation, Inc.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
This file is part of the GNU C Library.
@@ -33,11 +33,12 @@
u.fenv = *envp;
/* Clear everything except the rounding mode. */
u.l[0] &= 0x3;
-
- /* ?? Should we clear the disabled exceptions as well ?? */
+ /* Disable exceptions */
+ u.l[1] = FE_ALL_EXCEPT;
/* Put the new state in effect. */
- fesetenv (envp);
+ fesetenv (&u.fenv);
return 0;
}
+libm_hidden_def (feholdexcept)