public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Steven Munroe <munroesj@us.ibm.com>
To: Jakub Jelinek <jakub@redhat.com>, libc-ports@sources.redhat.com
Cc: Glibc hackers <libc-hacker@sources.redhat.com>,
	Ulrich Drepper <drepper@redhat.com>,
	Peter Eberlein <eberlein@us.ibm.com>
Subject: [PATCH] [PORTS] PPC fenv fixes for soft-fp
Date: Mon, 02 Apr 2007 16:43:00 -0000	[thread overview]
Message-ID: <4611368A.3030800@us.ibm.com> (raw)
In-Reply-To: <20070327160708.GA355@devserv.devel.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

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.


[-- Attachment #2: ports-feholdexcept-20070320.txt --]
[-- Type: text/plain, Size: 1196 bytes --]

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)


      parent reply	other threads:[~2007-04-02 16:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22 14:49 [PATCH] fenv fixes for x86_64/i386/ia64 Jakub Jelinek
2007-03-22 21:46 ` Steven Munroe
2007-03-27 15:53   ` [PATCH] PPC fenv fixes Steven Munroe
     [not found]     ` <20070327160708.GA355@devserv.devel.redhat.com>
2007-03-27 18:07       ` Steven Munroe
2007-03-28 15:29         ` Steven Munroe
2007-04-05  2:27           ` Richard Henderson
2007-04-05 22:00             ` [PATCH] PPC fenv fixes. 3rd update Steven Munroe
2007-04-14 17:32               ` Jakub Jelinek
2007-04-17  0:09                 ` Richard Henderson
     [not found]                   ` <20070417002157.GI355@devserv.devel.redhat.com>
2007-04-30 21:45                     ` Steven Munroe
2007-04-02 16:43       ` Steven Munroe [this message]

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=4611368A.3030800@us.ibm.com \
    --to=munroesj@us.ibm.com \
    --cc=drepper@redhat.com \
    --cc=eberlein@us.ibm.com \
    --cc=jakub@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=libc-ports@sources.redhat.com \
    /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: link
Be 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).