This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: Avoid spurious failures from <fenv.h> fallback functions


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

Attachment: pgpAhQJZkzJVv.pgp
Description: PGP signature


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