public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: <libc-ports@sourceware.org>
Subject: Make ARM feenableexcept detect failure (bug 14907)
Date: Mon, 17 Jun 2013 17:21:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1306171720430.10096@digraph.polyomino.org.uk> (raw)

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

                 reply	other threads:[~2013-06-17 17:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1306171720430.10096@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).