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: Fix fenv.h fallback returns (bug 14027)


On 04/27/2012 03:23 PM, Joseph S. Myers wrote:
C99(+TC1), and C11, explicitly say that feclearexcept, feraiseexcept
and fesetexceptflag return zero when their "excepts" operand is zero,
because nothing needs to be done in that case.

I propose this patch to fix the fallback implementations - the ones
for when no exceptions are supported, when no target-specific
implementation is used - to do so; to conform to the C standard
requirements, these operations should always be considered supported
and successful when applied to the empty set of exceptions, even when
no exceptions are supported.  Sanity checked with a soft-float MIPS
build.

I submitted this last year
<http://sourceware.org/ml/libc-alpha/2011-01/msg00005.html>  but it was
rejected based on an apparent confusion between ISO C and POSIX error
handling rules.  The notion of implementations defining additional
error conditions is a POSIX one; here, the semantics are fully defined
by ISO C ("The feclearexcept function returns zero if the excepts
argument is zero or if all the specified exceptions were successfully
cleared.", for example) and it's not valid for the functions to fail
with a zero argument any more than it's valid for memcpy to fail with
valid arguments for some implementation-defined reason.

2012-04-27 Joseph Myers<joseph@codesourcery.com>

	[BZ #14027]
	* math/fclrexcpt.c (__feclearexcept): Return zero if nothing needs
	to be done.
	* math/fraiseexcpt.c (__feraiseexcept): Likewise.
	* math/fsetexcptflg.c (__fesetexceptflag): Likewise.

Thanks, this is fine.


Andreas
--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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