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: Fix ARM fenv.h fallback returns
Date: Sun, 09 Jan 2011 23:51:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1101070142370.15480@digraph.polyomino.org.uk> (raw)

C99(+TC1) explicit says that feclearexcept, feraiseexcept and 
fesetexceptflag return zero when their "excepts" operand is zero, because 
nothing needs to be done in that case.  I've applied the patch to fix the 
ARM EABI implementations to do so when VFP is unavailable - these 
operations should always be considered supported and successful when 
applied to the empty set of exceptions, even when no exceptions are 
supported.

diff --git a/ChangeLog.arm b/ChangeLog.arm
index d02f269..8951801 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,10 @@
+2011-01-07  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/arm/eabi/fclrexcpt.c (__feclearexcept): Return zero if
+	unsupported but nothing needs to be done.
+	* sysdeps/arm/eabi/fraiseexcpt.c (feraiseexcept): Likewise.
+	* sysdeps/arm/eabi/fsetexcptflg.c (__fesetexceptflag): Likewise.
+
 2010-12-21  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/arm/stackinfo.h: Define DEFAULT_STACK_PERMS with PF_X.
diff --git a/sysdeps/arm/eabi/fclrexcpt.c b/sysdeps/arm/eabi/fclrexcpt.c
index 8287dc6..0bdd6a1 100644
--- a/sysdeps/arm/eabi/fclrexcpt.c
+++ b/sysdeps/arm/eabi/fclrexcpt.c
@@ -1,5 +1,5 @@
 /* Clear given exceptions in current floating-point environment.
-   Copyright (C) 1997,98,99,2000,01,05 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,01,05,11 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -48,8 +48,8 @@ __feclearexcept (int excepts)
       return 0;
     }
 
-  /* Unsupported, so fail.  */
-  return 1;
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
 }
 
 #include <shlib-compat.h>
diff --git a/sysdeps/arm/eabi/fraiseexcpt.c b/sysdeps/arm/eabi/fraiseexcpt.c
index 53ccd9d..78441ec 100644
--- a/sysdeps/arm/eabi/fraiseexcpt.c
+++ b/sysdeps/arm/eabi/fraiseexcpt.c
@@ -1,5 +1,5 @@
 /* Raise given exceptions.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -103,8 +103,8 @@ feraiseexcept (int excepts)
       return 0;
     }
 
-  /* Unsupported, so fail.  */
-  return 1;
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
 }
 
 libm_hidden_def (feraiseexcept)
diff --git a/sysdeps/arm/eabi/fsetexcptflg.c b/sysdeps/arm/eabi/fsetexcptflg.c
index 3dfeb2c..28966bb 100644
--- a/sysdeps/arm/eabi/fsetexcptflg.c
+++ b/sysdeps/arm/eabi/fsetexcptflg.c
@@ -1,5 +1,5 @@
 /* Set floating-point environment exception handling.
-   Copyright (C) 1997,98,99,2000,01,05,08 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,01,05,08,11 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -47,8 +47,8 @@ __fesetexceptflag (const fexcept_t *flagp, int excepts)
       return 0;
     }
 
-  /* Unsupported, so fail.  */
-  return 1;
+  /* Unsupported, so fail unless nothing needs to be done.  */
+  return (excepts != 0);
 }
 
 #include <shlib-compat.h>

-- 
Joseph S. Myers
joseph@codesourcery.com

                 reply	other threads:[~2011-01-07  1:45 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.1101070142370.15480@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).