]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hppa: Fix feholdexcpt and fesetenv (Bug 18110).
authorJohn David Anglin <danglin@gcc.gnu.org>
Wed, 11 Mar 2015 03:43:50 +0000 (23:43 -0400)
committerCarlos O'Donell <carlos@systemhalted.org>
Wed, 11 Mar 2015 06:48:22 +0000 (02:48 -0400)
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.

ChangeLog
NEWS
sysdeps/hppa/fpu/feholdexcpt.c
sysdeps/hppa/fpu/fesetenv.c

index cea5b0e3106cbee8b1949ce4a3c011b4cebc5700..26b6928f8359afe10d412c6099380c1947475f90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-11  John David Anglin  <danglin@gcc.gnu.org>
+
+       [BZ #18110]
+       * sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Don't modify bufptr in
+       asms.
+       * sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise.
+
 2015-03-11  Joseph Myers  <joseph@codesourcery.com>
 
        * soft-fp/soft-fp.h (_FP_UNREACHABLE): New macro.
diff --git a/NEWS b/NEWS
index 0e224ac41b81089b50801766e768ab1f8ad43a36..56405a14667e4d094791ce6d0cdcffe788598715 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,8 @@ Version 2.22
   16560, 16783, 17269, 17523, 17569, 17588, 17631, 17711, 17776, 17779,
   17792, 17836, 17912, 17916, 17932, 17944, 17949, 17964, 17965, 17967,
   17969, 17978, 17987, 17991, 17996, 17998, 17999, 18019, 18020, 18029,
-  18030, 18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18104.
+  18030, 18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18104,
+  18110.
 
 * Character encoding and ctype tables were updated to Unicode 7.0.0, using
   new generator scripts contributed by Pravin Satpute and Mike FABIAN (Red
index 94eba374416f4cc340ad40d81ebc642daee7fe3b..1db2775cd6e68e120fb5cbe95d65544bcda6ca22 100644 (file)
@@ -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;
index 5b33ad61027ad17edc1568261d15f9e46302b1fd..5de755d3b50122055cc180f717a89ad3051517ab 100644 (file)
@@ -33,7 +33,7 @@ __fesetenv (const fenv_t *envp)
      we want to use from the environment specified by the parameter.  */
   bufptr = temp.buf;
   __asm__ (
-          "fstd,ma %%fr0,8(%1)\n"
+          "fstd %%fr0,0(%1)\n"
           : "=m" (temp) : "r" (bufptr) : "%r0");
 
   temp.env.__status_word &= ~(FE_ALL_EXCEPT
@@ -54,7 +54,7 @@ __fesetenv (const fenv_t *envp)
      we take advantage of that to load in reverse order so fr0
      is loaded last and T-Bit is enabled. */
   __asm__ (
-          "fldd,mb -8(%1),%%fr0\n"
+          "fldd 0(%1),%%fr0\n"
           : : "m" (temp), "r" (bufptr) : "%r0" );
 
   /* Success.  */