about summary refs log tree commit diff
path: root/sysdeps/hppa/fpu/feholdexcpt.c
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2015-03-10 23:43:50 -0400
committerCarlos O'Donell <carlos@systemhalted.org>2015-03-11 02:48:22 -0400
commitfae1aa8d226ce860124efd67ede03004b19b89e2 (patch)
treea78b3c667766a495d00e98a21152df1994bec88a /sysdeps/hppa/fpu/feholdexcpt.c
parent068a6274556f9f362443648f4fd47525c8cf2dba (diff)
downloadglibc-fae1aa8d226ce860124efd67ede03004b19b89e2.tar.gz
glibc-fae1aa8d226ce860124efd67ede03004b19b89e2.tar.xz
glibc-fae1aa8d226ce860124efd67ede03004b19b89e2.zip
hppa: Fix feholdexcpt and fesetenv (Bug 18110).
The constraints in the inline assembly in feholdexcept and fesetenv
are incorrect. The assembly modifies the buffer pointer, but doesn't
express that in the constraints. The simple fix is to remove the
modification of the buffer pointer which is no longer required by
the existing code, and adjust the one constraint that did express
the modification of bufptr.

The change fixes test-fenv when glibc is compiled with recent gcc.
Diffstat (limited to 'sysdeps/hppa/fpu/feholdexcpt.c')
-rw-r--r--sysdeps/hppa/fpu/feholdexcpt.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sysdeps/hppa/fpu/feholdexcpt.c b/sysdeps/hppa/fpu/feholdexcpt.c
index 94eba37441..1db2775cd6 100644
--- a/sysdeps/hppa/fpu/feholdexcpt.c
+++ b/sysdeps/hppa/fpu/feholdexcpt.c
@@ -29,8 +29,8 @@ __feholdexcept (fenv_t *envp)
   /* Store the environment.  */
   bufptr = clear.buf;
   __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
-	   : "=m" (clear), "+r" (bufptr) : : "%r0");
+	   "fstd %%fr0,0(%1)\n"
+	   : "=m" (clear) : "r" (bufptr) : "%r0");
   memcpy (envp, &clear.env, sizeof (fenv_t));
 
   /* Clear exception queues */
@@ -40,11 +40,9 @@ __feholdexcept (fenv_t *envp)
   /* Now clear all flags  */
   clear.env.__status_word &= ~(FE_ALL_EXCEPT << 27);
 
-  /* Load the new environment. Note: fr0 must load last to enable T-bit
-     Thus we start bufptr at the end and work backwards */
-  bufptr = (unsigned long long *)((unsigned int)(clear.buf) + sizeof(unsigned int)*4);
+  /* Load the new environment. Note: fr0 must load last to enable T-bit.  */
   __asm__ (
-	   "fldd,mb -8(%0),%%fr0\n"
+	   "fldd 0(%0),%%fr0\n"
 	   : : "r" (bufptr), "m" (clear) : "%r0");
 
   return 0;