public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized [committed]
@ 2015-05-22 18:02 Joseph Myers
  0 siblings, 0 replies; only message in thread
From: Joseph Myers @ 2015-05-22 18:02 UTC (permalink / raw)
  To: libc-alpha

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

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.

diff --git a/sysdeps/ieee754/ldbl-128/e_asinl.c b/sysdeps/ieee754/ldbl-128/e_asinl.c
index 353603d..691ac26 100644
--- a/sysdeps/ieee754/ldbl-128/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-128/e_asinl.c
@@ -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
 	{
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
index 00386db..5bc847a 100644
--- a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -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
 	{

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-22 17:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-22 18:02 Fix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized [committed] Joseph Myers

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