]> sourceware.org Git - glibc.git/commitdiff
Fix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 22 May 2015 17:36:52 +0000 (17:36 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 22 May 2015 17:36:52 +0000 (17:36 +0000)
The ldbl-128 and ldbl-128ibm implementations of asinl produce
uninitialized variable warnings with -Wuninitialized because the code
for small arguments in fact always returns but the compiler cannot see
this and instead sees that a variable would be uninitialized if the
"if (huge + x > one)" conditional used to force the "inexact"
exception were false.

All the code in libm trying to force "inexact" for functions that are
not exactly defined is suspect and should be removed at some point
given that we now have a clear definition of the accuracy goals for
libm functions which, following C99/C11, does not require anything
about "inexact" for most functions (likewise, the multi-precision code
that tries to give correctly-rounded results, very slowly, for
functions for which the goals clearly do not include correct rounding,
if the faster paths are accurate enough).  However, for now this patch
simply changes the code to use math_force_eval, rather than "if", to
ensure the evaluation of the inexact computation.

Tested for powerpc and mips64.

* sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Don't use
a conditional in forcing "inexact".
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl):
Likewise.

ChangeLog
sysdeps/ieee754/ldbl-128/e_asinl.c
sysdeps/ieee754/ldbl-128ibm/e_asinl.c

index 059f9d2783174b041f43b175170a4ce50ce03625..21c4fa68e00060d862f93bc406d8f9afe75e3445 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-22  Joseph Myers  <joseph@codesourcery.com>
+
+       * sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Don't use
+       a conditional in forcing "inexact".
+       * sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl):
+       Likewise.
+
 2015-05-22  Roland McGrath  <roland@hack.frob.com>
 
        * nptl/nptl-init.c (__pthread_initialize_minimal_internal):
index 353603d68cee868851c033f3472462b7dfc39112..691ac267fb65715ba4a0a16d05c5e7e3fcd530e4 100644 (file)
@@ -158,8 +158,9 @@ __ieee754_asinl (long double x)
              long double force_underflow = x * x;
              math_force_eval (force_underflow);
            }
-         if (huge + x > one)
-           return x;           /* return x with inexact if x!=0 */
+         long double force_inexact = huge + x;
+         math_force_eval (force_inexact);
+         return x;             /* return x with inexact if x!=0 */
        }
       else
        {
index 00386db04ebc211e7b896f46be7b06e79564e182..5bc847ad26bfdad5f4a5b8156686bfd4936b40d9 100644 (file)
@@ -152,8 +152,9 @@ __ieee754_asinl (long double x)
              long double force_underflow = x * x;
              math_force_eval (force_underflow);
            }
-         if (huge + x > one)
-           return x;           /* return x with inexact if x!=0 */
+         long double force_inexact =  huge + x;
+         math_force_eval (force_inexact);
+         return x;             /* return x with inexact if x!=0 */
        }
       else
        {
This page took 0.110171 seconds and 5 git commands to generate.