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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Make ARM feenableexcept detect failure (bug 14907)


I've committed this patch to make ARM feenableexcept test whether
enabling exception traps succeeded, similarly to the tests in
fesetenv.  Tested on hardware with VFPv2 (supports exception traps)
and VFPv3 (doesn't).

(This doesn't fix the failures of math/test-fenv for VFPv3 - that test
currently has no way to handle runtime failure of either fesetenv or
feenableexcept as being expected on some systems - but is a
prerequisite for fixing those failures.  Of course with proper
reporting of the status of individual test assertions, ideally the
affected assertions in test-fenv would report UNSUPPORTED status on
the affected hardware rather than being quietly skipped.)

2013-06-17  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14907]
	* sysdeps/arm/feenablxcpt.c (feenableexcept): Test whether all
	requested exception traps were enabled and return -1 if not.

diff --git a/ports/sysdeps/arm/feenablxcpt.c b/ports/sysdeps/arm/feenablxcpt.c
index baad432..e2e287b 100644
--- a/ports/sysdeps/arm/feenablxcpt.c
+++ b/ports/sysdeps/arm/feenablxcpt.c
@@ -39,6 +39,18 @@ feenableexcept (int excepts)
 
       _FPU_SETCW(new_exc);
 
+      if (excepts != 0)
+	{
+	  /* VFPv3 and VFPv4 do not support trapping exceptions, so
+	     test whether the relevant bits were set and fail if
+	     not.  */
+	  unsigned int temp;
+	  _FPU_GETCW (temp);
+	  if ((temp & (excepts << FE_EXCEPT_SHIFT))
+	      != (excepts << FE_EXCEPT_SHIFT))
+	    return -1;
+	}
+
       return old_exc;
     }
 

-- 
Joseph S. Myers
joseph@codesourcery.com


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