Avoid spurious failures from <fenv.h> fallback functions

Thomas Schwinge thomas@codesourcery.com
Fri Jun 21 08:07:00 GMT 2013


Hi!

On Fri, 21 Jun 2013 08:46:19 +0900, Kaz Kojima <kkojima@rr.iij4u.or.jp> wrote:
> "Joseph S. Myers" <joseph@codesourcery.com> wrote:
> > Kaz, Thomas, note that there is no SH version of fgetexcptflg.c.  This
> > looks like an oversight, given that all the other <fenv.h> functions
> > have SH implementations.  Neither old nor new stub version would
> > really be correct for SH; there should be a real implementation.
> > Filed as bug 15655.
> 
> It's really an oversight.  I'd like to commit the attached patch
> if it's OK to Thomas.

> 2013-06-21  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
> 
	[BZ #15655]
> 	* sysdeps/sh/sh4/fpu/fgetexcptflg.c: New file.
> 
> diff --git a/sysdeps/sh/sh4/fpu/fgetexcptflg.c b/sysdeps/sh/sh4/fpu/fgetexcptflg.c
> new file mode 100644
> index 0000000..6a2a0c0
> --- /dev/null
> +++ b/sysdeps/sh/sh4/fpu/fgetexcptflg.c
> @@ -0,0 +1,38 @@
> +[...]
> +#include <fenv.h>
> +#include <fpu_control.h>
> +
> +int
> +fegetexceptflag (fexcept_t *flagp, int excepts)
> +{
> +  fpu_control_t temp;
> +
> +  /* Get the current exceptions.  */
> +  _FPU_GETCW (temp);
> +
> +  /* We only save the relevant bits here. In particular, care has to be
> +     taken with the CAUSE bits, as an inadvertent restore later on could
> +     generate unexpected exceptions.  */
> +
> +  *flagp = temp & excepts & FE_ALL_EXCEPT;
> +
> +  /* Success.  */
> +  return 0;
> +}

That three-line comment makes me think this is a copy of the MIPS sysdeps
file; but yes, the implementation looks good to me.


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130621/cc6f62d8/attachment.sig>


More information about the Libc-alpha mailing list