standards/56906: Several math(3) functions fail to set errno on a domain error

Bruce Evans bde at zeta.org.au
Fri Mar 12 04:30:20 PST 2004


The following reply was made to PR standards/56906; it has been noted by GNATS.

From: Bruce Evans <bde at zeta.org.au>
To: Stefan Farfeleder <stefan at fafoe.narf.at>
Cc: bug-followup at freebsd.org, freebsd-standards at freebsd.org
Subject: Re: standards/56906: Several math(3) functions fail to set errno on
 a domain error
Date: Fri, 12 Mar 2004 23:21:41 +1100 (EST)

 Long ago, on Tue, 16 Sep 2003, Stefan Farfeleder wrote:
 
 > On Tue, Sep 16, 2003 at 11:42:44AM +1000, Bruce Evans wrote:
 > > On Tue, 16 Sep 2003, Stefan Farfeleder wrote:
 > > > >Description:
 > > > ISO C90 says that errno must be set to EDOM if a domain error occurs.
 > >
 > > As you probably know, C99 doesn't require this.  ...
 >
 > Hm, having a conforming C90 environment would be nice despite C99's
 > existence as older compliant applications may depend on the former
 > behaviour and don't become magically C99 conformant.  Is there a chance
 > to have a separated C90 compliant libm?
 
 Looks like not a large chance :-).  Old applications have somehow dealt
 with FreeBSD's libm not having C90-conformant error handling for 10+
 years, so fixing this doesn't seem urgent.
 
 > Anyway, here's a patch to give C99 application at least the possibility
 > to notice that errno doesn't get set for these functions.  Because we
 > don't have <fenv.h> to access the floating point status flags, I'm
 > setting math_errhandling to 0.
 
 Committed with minor reordering.  I wasn't sure about the C99 visibility
 ifdef because my (draft) copy of C99 doesn't have MATH_ERRO, but
 POSIX.1-2001 doesn't say that it is an extension and glibc uses the same
 ifdef, so I assumed that the ifdef is correct.
 
 David Schulz has <fenv.h> almost ready, but we are still missing both a
 compiler that actually understands <fenv.h> and sources that set the
 exception flags in a way that doesn't get optimized (FENV_ACCESS should
 make the current code work, but is not supported by the compiler, and
 changing all the flags-setting hacks like huge*huge to explicitly set
 exception flags would require large changes).
 
 Bruce


More information about the freebsd-standards mailing list