public inbox for
 help / color / mirror / Atom feed
* Make ARM feenableexcept detect failure (bug 14907)
@ 2013-06-17 17:21 Joseph S. Myers
  0 siblings, 0 replies; only message in thread
From: Joseph S. Myers @ 2013-06-17 17:21 UTC (permalink / raw)
  To: libc-ports

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

	[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)
+      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

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

only message in thread, other threads:[~2013-06-17 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-17 17:21 Make ARM feenableexcept detect failure (bug 14907) Joseph S. 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).