This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix test-fenv


Hi!

Even other parts of test-fenv already ignore inexact exceptions when raising
overflow/underflow, so we should disable it in the feexcp_mask_test as well.
Makes test-fenv pass all tests on sparc64...

2000-09-27  Jakub Jelinek  <jakub@redhat.com>

	* math/test-fenv.c (feexcp_mask_test): If enabling all exceptions
	and disabling underflow or overflow, disable inexact as well.

--- libc/math/test-fenv.c.jj	Sun Aug 20 18:53:25 2000
+++ libc/math/test-fenv.c	Wed Sep 27 10:36:55 2000
@@ -399,7 +399,7 @@ feexcp_nomask_test (const char *flag_nam
 static void
 feexcp_mask_test (const char *flag_name, int fe_exc)
 {
-  int status;
+  int status, exception;
   pid_t pid;
 
   printf ("Test: after fedisable (%s) processes will not abort\n", flag_name);
@@ -415,7 +415,20 @@ feexcp_mask_test (const char *flag_name,
       setrlimit (RLIMIT_CORE, &core_limit);
 #endif
       feenableexcept (FE_ALL_EXCEPT);
-      fedisableexcept (fe_exc);
+      exception = fe_exc;
+#ifdef FE_INEXACT
+      /* The standard allows the inexact exception to be set together with the
+	 underflow and overflow exceptions.  So add FE_INEXACT to the set of
+	 exceptions to be disabled if we will be raising underflow or
+	 overflow.  */
+# ifdef FE_OVERFLOW
+      if (fe_exc & FE_OVERFLOW) exception |= FE_INEXACT;
+# endif
+# ifdef FE_UNDERFLOW
+      if (fe_exc & FE_UNDERFLOW) exception |= FE_INEXACT;
+# endif
+#endif
+      fedisableexcept (exception);
       feraiseexcept (fe_exc);
       exit (2);
     }

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]