public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix feholdexcept on s390{,x}
@ 2007-05-09 16:24 Jakub Jelinek
  2007-05-10  7:22 ` Martin Schwidefsky
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2007-05-09 16:24 UTC (permalink / raw)
  To: Ulrich Drepper, Martin Schwidefsky; +Cc: Glibc hackers

Hi!

feholdexcept is supposed to save the current fenv, then clear the
status flags and stop generating all exceptions.  But on s390{,x}
feholdexcept was also clearing the exceptions in the saved fenv_t.
Fixes test-fenv on s390*.

2007-05-09  Jakub Jelinek  <jakub@redhat.com>

	[BZ #3427]
	* sysdeps/s390/fpu/feholdexcpt.c (feholdexcept): Don't clear exceptions
	in *envp.

--- libc/sysdeps/s390/fpu/feholdexcpt.c.jj	2005-07-08 14:52:46.000000000 -0400
+++ libc/sysdeps/s390/fpu/feholdexcpt.c	2007-05-09 12:09:01.000000000 -0400
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
 
@@ -23,13 +23,14 @@
 
 int feholdexcept (fenv_t *envp)
 {
+  fexcept_t fpc;
   /* Store the environment.  */
   fegetenv (envp);
   /* Clear the current sticky bits as more than one exception
      may be generated.  */
-  envp->fpc &= ~(FPC_FLAGS_MASK | FPC_DXC_MASK);
+  fpc = envp->fpc & ~(FPC_FLAGS_MASK | FPC_DXC_MASK);
   /* Hold from generating fpu exceptions temporarily.  */
-  _FPU_SETCW ((envp->fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
+  _FPU_SETCW ((fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
   return 0;
 }
 libm_hidden_def (feholdexcept)

	Jakub

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

* Re: [PATCH] Fix feholdexcept on s390{,x}
  2007-05-09 16:24 [PATCH] Fix feholdexcept on s390{,x} Jakub Jelinek
@ 2007-05-10  7:22 ` Martin Schwidefsky
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Schwidefsky @ 2007-05-10  7:22 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

On Wed, 2007-05-09 at 18:32 +0200, Jakub Jelinek wrote:
> feholdexcept is supposed to save the current fenv, then clear the
> status flags and stop generating all exceptions.  But on s390{,x}
> feholdexcept was also clearing the exceptions in the saved fenv_t.
> Fixes test-fenv on s390*.

That bug has been there from day 1 and nobody noticed until now. Sigh.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.


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

end of thread, other threads:[~2007-05-10  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 16:24 [PATCH] Fix feholdexcept on s390{,x} Jakub Jelinek
2007-05-10  7:22 ` Martin Schwidefsky

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