From owner-freebsd-standards@FreeBSD.ORG Mon Mar 8 09:10:10 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC86B16A4CE for ; Mon, 8 Mar 2004 09:10:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DBDE743D2F for ; Mon, 8 Mar 2004 09:10:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i28HAAbv062575 for ; Mon, 8 Mar 2004 09:10:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i28HAAmB062574; Mon, 8 Mar 2004 09:10:10 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 8 Mar 2004 09:10:10 -0800 (PST) Resent-Message-Id: <200403081710.i28HAAmB062574@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stefan Farfeleder Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC9D716A4CE for ; Mon, 8 Mar 2004 09:02:50 -0800 (PST) Received: from fafoe.narf.at (unknown [212.186.3.235]) by mx1.FreeBSD.org (Postfix) with ESMTP id 267CF43D1D for ; Mon, 8 Mar 2004 09:02:50 -0800 (PST) (envelope-from stefan@fafoe.narf.at) Received: from wombat.fafoe.narf.at (wombat.fafoe.narf.at [192.168.1.42]) by fafoe.narf.at (Postfix) with ESMTP id 285D53FA8; Mon, 8 Mar 2004 18:02:43 +0100 (CET) Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id F121B4CB; Mon, 8 Mar 2004 18:02:41 +0100 (CET) Message-Id: <20040308170241.F121B4CB@wombat.fafoe.narf.at> Date: Mon, 8 Mar 2004 18:02:41 +0100 (CET) From: Stefan Farfeleder To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: stefan@fafoe.narf.at Subject: standards/63935: [patch] Fix C90 namespace pollution in X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan Farfeleder List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2004 17:10:11 -0000 >Number: 63935 >Category: standards >Synopsis: [patch] Fix C90 namespace pollution in >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 08 09:10:10 PST 2004 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD wombat.fafoe.narf.at 5.2-CURRENT FreeBSD 5.2-CURRENT #16: Tue Mar 2 19:09:53 CET 2004 stefan@wombat.fafoe.narf.at:/usr/home/stefan/freebsd/obj/usr/home/stefan/freebsd/src/sys/WOMBAT i386 >Description: C99 added the macros FLT_EVAL_METHOD and DECIMAL_DIG to . Since these identifiers aren't in the namespace reserved for the implementation, a strictly compliant C90 program is allowed to use them. They must not be visible in a C90 compilation mode like they currently are. >How-To-Repeat: $ cat test.c #include int main(void) { int FLT_EVAL_METHOD, DECIMAL_DIG; return 0; } $ c89 -D_ANSI_SOURCE test.c test.c: In function `main': test.c:6: error: syntax error before '-' token >Fix: --- float.h.diff begins here --- Index: src/sys/alpha/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/alpha/include/float.h,v retrieving revision 1.4 diff -u -r1.4 float.h --- src/sys/alpha/include/float.h 8 Feb 2003 20:37:54 -0000 1.4 +++ src/sys/alpha/include/float.h 8 Mar 2004 15:31:24 -0000 @@ -45,8 +45,10 @@ #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS __flt_rounds() +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 0 /* no promotions */ #define DECIMAL_DIG 17 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ Index: src/sys/amd64/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/amd64/include/float.h,v retrieving revision 1.10 diff -u -r1.10 float.h --- src/sys/amd64/include/float.h 8 Feb 2003 20:37:54 -0000 1.10 +++ src/sys/amd64/include/float.h 8 Mar 2004 15:57:46 -0000 @@ -37,10 +37,14 @@ #ifndef _MACHINE_FLOAT_H_ #define _MACHINE_FLOAT_H_ 1 +#include + #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ #define DECIMAL_DIG 21 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ Index: src/sys/i386/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/i386/include/float.h,v retrieving revision 1.10 diff -u -r1.10 float.h --- src/sys/i386/include/float.h 8 Feb 2003 20:37:54 -0000 1.10 +++ src/sys/i386/include/float.h 8 Mar 2004 15:57:52 -0000 @@ -37,10 +37,14 @@ #ifndef _MACHINE_FLOAT_H_ #define _MACHINE_FLOAT_H_ 1 +#include + #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ #define DECIMAL_DIG 21 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ Index: src/sys/ia64/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/ia64/include/float.h,v retrieving revision 1.4 diff -u -r1.4 float.h --- src/sys/ia64/include/float.h 27 Mar 2003 20:38:22 -0000 1.4 +++ src/sys/ia64/include/float.h 8 Mar 2004 15:32:04 -0000 @@ -41,8 +41,10 @@ #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 0 /* no promotions */ #define DECIMAL_DIG 35 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ Index: src/sys/powerpc/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/powerpc/include/float.h,v retrieving revision 1.3 diff -u -r1.3 float.h --- src/sys/powerpc/include/float.h 21 Jan 2004 04:56:39 -0000 1.3 +++ src/sys/powerpc/include/float.h 8 Mar 2004 15:58:00 -0000 @@ -38,10 +38,14 @@ #ifndef _MACHINE_FLOAT_H_ #define _MACHINE_FLOAT_H_ 1 +#include + #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS 1 /* FP addition rounds to nearest */ +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 1 /* operands promoted to double */ #define DECIMAL_DIG 35 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ Index: src/sys/sparc64/include/float.h =================================================================== RCS file: /usr/home/ncvs/src/sys/sparc64/include/float.h,v retrieving revision 1.3 diff -u -r1.3 float.h --- src/sys/sparc64/include/float.h 8 Feb 2003 20:37:55 -0000 1.3 +++ src/sys/sparc64/include/float.h 8 Mar 2004 15:31:50 -0000 @@ -55,8 +55,10 @@ #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS __flt_rounds() +#if __ISO_C_VISIBLE >= 1999 #define FLT_EVAL_METHOD 0 /* no promotion */ #define DECIMAL_DIG 35 /* max precision in decimal digits */ +#endif #define FLT_MANT_DIG 24 /* p */ #define FLT_EPSILON 1.19209290E-7F /* b**(1-p) */ --- float.h.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-standards@FreeBSD.ORG Mon Mar 8 11:01:44 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A404416A4CE for ; Mon, 8 Mar 2004 11:01:44 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8969D43D2D for ; Mon, 8 Mar 2004 11:01:44 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) i28J1ibv072794 for ; Mon, 8 Mar 2004 11:01:44 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i28J1hfr072788 for freebsd-standards@freebsd.org; Mon, 8 Mar 2004 11:01:43 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 8 Mar 2004 11:01:43 -0800 (PST) Message-Id: <200403081901.i28J1hfr072788@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-standards@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2004 19:01:44 -0000 Current FreeBSD problem reports Critical problems Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- s [2001/01/23] misc/24590 standards timezone function not compatible witn Sin o [2001/03/05] bin/25542 standards /bin/sh: null char in quoted string o [2002/02/25] bin/35307 standards standard include files are not standard c o [2003/03/05] bin/48958 standards The type 'bool' has different sizes for C o [2003/04/21] standards/51209standards [PATCH] add a64l()/l64a/l64a_r functions p [2003/06/05] standards/52972standards /bin/sh arithmetic not POSIX compliant o [2003/07/12] standards/54410standards one-true-awk not POSIX compliant (no exte o [2003/09/15] standards/56906standards Several math(3) functions fail to set err o [2003/12/31] standards/60772standards _Bool and bool should be unsigned o [2004/02/05] standards/62388standards sys/resource.h does not pull in dependenc 10 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- f [1995/01/11] i386/105 standards Distributed libm (msun) has non-standard o [2000/09/24] bin/21519 standards sys/dir.h should be deprecated some more o [2000/12/05] kern/23304 standards POSIX clock_gettime, clock_getres return o [2001/01/16] bin/24390 standards Replacing old dir-symlinks when using /bi s [2001/06/18] kern/28260 standards UIO_MAXIOV needs to be made public o [2001/11/20] standards/32126standards getopt(3) not Unix-98 conformant s [2002/03/18] standards/36076standards Implementation of POSIX fuser command o [2002/06/13] standards/39256standards [v]snprintf aren't POSIX-conformant for s o [2002/07/09] misc/40378 standards stdlib.h gives needless warnings with -an p [2002/08/12] standards/41576standards POSIX compliance of ln(1) o [2002/10/23] standards/44425standards getcwd() succeeds even if current dir has o [2002/12/09] standards/46119standards Priority problems for SCHED_OTHER using p o [2002/12/23] standards/46504standards Warnings in headers o [2003/06/22] standards/53613standards FreeBSD doesn't define EPROTO o [2003/06/24] bin/53682 standards [PATCH] add fuser(1) utitity o [2003/07/24] standards/54809standards pcvt deficits o [2003/07/24] standards/54833standards more pcvt deficits o [2003/07/25] standards/54839standards pcvt deficits o [2003/07/31] standards/55112standards glob.h, glob_t's gl_pathc should be "size o [2003/09/04] standards/56476standards cd9660 unicode support simple hack o [2003/09/27] standards/57295standards [patch] make does not include cmd line va o [2003/10/12] standards/57911standards fnmatch ("[[:alpha:]]","x", FNM_PATHNAME) o [2003/10/29] standards/58676standards grantpt(3) alters storage used by ptsname o [2003/11/29] standards/59797standards Implement C99's round[f]() math fucntions p [2003/12/26] standards/60597standards FreeBSD's /usr/include lacks of cpio.h s [2004/02/14] standards/62858standards malloc(0) not C99 compliant p [2004/02/21] standards/63173standards Patch to add getopt_long_only(3) to libc o [2004/02/25] standards/63371standards [patch] isblank() not in C99/SUSv3 namesp o [2004/03/08] standards/63935standards [patch] Fix C90 namespace pollution in Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 800A916A4CE for ; Wed, 10 Mar 2004 14:23:19 -0800 (PST) Received: from jkh-gw.brierdr.com (adsl-64-173-3-158.dsl.sntc01.pacbell.net [64.173.3.158]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3EDA43D4C for ; Wed, 10 Mar 2004 14:22:58 -0800 (PST) (envelope-from jkh@queasyweasel.com) Received: from [64.173.15.98] (IDENT:1604-ident-is-a-completely-pointless-protocol-that-offers-no-security-or-traceability-at-all-so-tak@adsl-64-173-15-98.dsl.sntc01.pacbell.net [64.173.15.98]) by jkh-gw.brierdr.com (8.12.10/8.12.10) with ESMTP id i2AMNdik002787 for ; Wed, 10 Mar 2004 14:23:42 -0800 (PST) (envelope-from jkh@queasyweasel.com) Mime-Version: 1.0 (Apple Message framework v613) Content-Transfer-Encoding: 7bit Message-Id: <672CEF48-72E1-11D8-B113-000393BB9222@queasyweasel.com> Content-Type: text/plain; charset=US-ASCII; format=flowed To: freebsd-standards@freebsd.org From: "Jordan K. Hubbard" Date: Wed, 10 Mar 2004 14:22:23 -0800 X-Mailer: Apple Mail (2.613) Subject: Behavior of expr(1) and standards conformance. X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2004 22:23:19 -0000 In the man page for expr(1) on FreeBSD 5.x, we see the following statement: Compatibility with previous implementations Unless FreeBSD 4.x compatibility is enabled, this version of expr adheres to the POSIX Utility Syntax Guidelines, which require that a leading argument beginning with a minus sign be considered an option to the program. I believe this is wrong, however, since the only "standards docs" for expr(1) can find are here: http://www.opengroup.org/onlinepubs/007908799/xcu/expr.html And they say nothing about allowing - arguments, Utility Syntax Guidelines notwithstanding (and "guidelines" are, by definition, not necessarily universally binding). More to the point, The Open Group's UNIX conformance tests expect to be able to do stuff like this: expr -c : '\([+-]\)' And have it return an appropriate error code (0). Under FreeBSD's expr(1), this falls over on its face, and the documentation on the compat hack added to expr seems to strongly imply that it's conformant as it currently stands, the /etc/compat/FreeBSD-4-util hack being what one does to make it non-conformant. I believe this is backwards. Comments? -- Jordan K. Hubbard Engineering Manager, BSD technology group Apple Computer From owner-freebsd-standards@FreeBSD.ORG Wed Mar 10 15:10:12 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 328BF16A4CE for ; Wed, 10 Mar 2004 15:10:12 -0800 (PST) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF4CC43D31 for ; Wed, 10 Mar 2004 15:10:11 -0800 (PST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.9/8.12.9) with ESMTP id i2ANA8Da009907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK CN=khavrinen.lcs.mit.edu issuer=SSL+20Client+20CA); Wed, 10 Mar 2004 18:10:08 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.9/8.12.9/Submit) id i2ANA83j009904; Wed, 10 Mar 2004 18:10:08 -0500 (EST) (envelope-from wollman) Date: Wed, 10 Mar 2004 18:10:08 -0500 (EST) From: Garrett Wollman Message-Id: <200403102310.i2ANA83j009904@khavrinen.lcs.mit.edu> To: "Jordan K. Hubbard" In-Reply-To: <672CEF48-72E1-11D8-B113-000393BB9222@queasyweasel.com> References: <672CEF48-72E1-11D8-B113-000393BB9222@queasyweasel.com> X-Spam-Score: -19.8 () IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES X-Scanned-By: MIMEDefang 2.37 cc: freebsd-standards@freebsd.org Subject: Behavior of expr(1) and standards conformance. X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2004 23:10:12 -0000 < said: > And they say nothing about allowing - arguments, Utility Syntax > Guidelines notwithstanding > (and "guidelines" are, by definition, not necessarily universally > binding). The Utility Syntax Guidelines *are* binding on all POSIX utilities which are not otherwise so documented. (If I had an hour to search the documents I could quote chapter and verse on this one.) > More to the point, The Open Group's UNIX conformance tests expect to > be able to do stuff like this: > expr -c : '\([+-]\)' Then they are wrong, and you should file a bug report. This issue was the subject of an bug report against 1003.1-2001 and FreeBSD's behavior follows the resolution of that report. -GAWollman From owner-freebsd-standards@FreeBSD.ORG Fri Mar 12 04:22:05 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C960016A4CE; Fri, 12 Mar 2004 04:22:05 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BDF743D2D; Fri, 12 Mar 2004 04:22:03 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])i2CCLinX009302; Fri, 12 Mar 2004 23:21:44 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i2CCLfGi015695; Fri, 12 Mar 2004 23:21:43 +1100 Date: Fri, 12 Mar 2004 23:21:41 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Stefan Farfeleder In-Reply-To: <20030916130805.GD697@wombat.fafoe.narf.at> Message-ID: <20040312230554.V10266@gamplex.bde.org> References: <20030915225329.95B30498@frog.fafoe.narf.at> <20030916130805.GD697@wombat.fafoe.narf.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-standards@freebsd.org cc: bug-followup@freebsd.org Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 12:22:05 -0000 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 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 almost ready, but we are still missing both a compiler that actually understands 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 From owner-freebsd-standards@FreeBSD.ORG Fri Mar 12 04:30:20 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7856916A4CE for ; Fri, 12 Mar 2004 04:30:20 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A75543D54 for ; Fri, 12 Mar 2004 04:30:20 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2CCUKbv055654 for ; Fri, 12 Mar 2004 04:30:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2CCUKWK055653; Fri, 12 Mar 2004 04:30:20 -0800 (PST) (envelope-from gnats) Date: Fri, 12 Mar 2004 04:30:20 -0800 (PST) Message-Id: <200403121230.i2CCUKWK055653@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Bruce Evans Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Bruce Evans List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 12:30:20 -0000 The following reply was made to PR standards/56906; it has been noted by GNATS. From: Bruce Evans To: Stefan Farfeleder Cc: bug-followup@freebsd.org, freebsd-standards@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 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 almost ready, but we are still missing both a compiler that actually understands 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 From owner-freebsd-standards@FreeBSD.ORG Fri Mar 12 10:50:21 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C84816A4CE for ; Fri, 12 Mar 2004 10:50:21 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 082D943D41 for ; Fri, 12 Mar 2004 10:50:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2CIoKbv071681 for ; Fri, 12 Mar 2004 10:50:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2CIoKP9071680; Fri, 12 Mar 2004 10:50:20 -0800 (PST) (envelope-from gnats) Resent-Date: Fri, 12 Mar 2004 10:50:20 -0800 (PST) Resent-Message-Id: <200403121850.i2CIoKP9071680@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stefan Farfeleder Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDC0A16A4CF for ; Fri, 12 Mar 2004 10:41:42 -0800 (PST) Received: from fafoe.narf.at (unknown [212.186.3.235]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EE2B43D41 for ; Fri, 12 Mar 2004 10:41:42 -0800 (PST) (envelope-from stefan@fafoe.narf.at) Received: from wombat.fafoe.narf.at (wombat.fafoe.narf.at [192.168.1.42]) by fafoe.narf.at (Postfix) with ESMTP id CA19740ED; Fri, 12 Mar 2004 19:41:38 +0100 (CET) Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id CF74D480; Fri, 12 Mar 2004 19:41:36 +0100 (CET) Message-Id: <20040312184136.CF74D480@wombat.fafoe.narf.at> Date: Fri, 12 Mar 2004 19:41:36 +0100 (CET) From: Stefan Farfeleder To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: stefan@fafoe.narf.at Subject: standards/64173: C99 requires some macros to be constant expressions X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan Farfeleder List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 18:50:21 -0000 >Number: 64173 >Category: standards >Synopsis: C99 requires some macros to be constant expressions >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 12 10:50:20 PST 2004 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD wombat.fafoe.narf.at 5.2-CURRENT FreeBSD 5.2-CURRENT #16: Tue Mar 2 19:09:53 CET 2004 stefan@wombat.fafoe.narf.at:/usr/home/stefan/freebsd/obj/usr/home/stefan/freebsd/src/sys/WOMBAT i386 >Description: Quoting from ISO/IEC 9899:1999: # 7.12 Mathematics # 3 The macro # HUGE_VAL # expands to a positive double constant expression, not necessarily representable as a # float. The macros # HUGE_VALF # HUGE_VALL # are respectively float and long double analogs of HUGE_VAL.191) # # 4 The macro # INFINITY # expands to a constant expression of type float representing positive or unsigned # infinity, if available; else to a positive constant of type float that overflows at # translation time.192) # # 5 The macro # NAN # is defined if and only if the implementation supports quiet NaNs for the float type. It # expands to a constant expression of type float representing a quiet NaN. These macros expand to the variables __infinity and __nan currently (defined in src/lib/${ARCH}/gen/infinity.c), thus violating the requirement of being constant expressions. >How-To-Repeat: This strictly conformant C99 program fails to compile: $ cat test.c #include double d = HUGE_VAL; int main(void) {} $ c99 test.c test.c:2: error: initializer element is not constant >Fix: None yet. >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-standards@FreeBSD.ORG Fri Mar 12 13:46:47 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AFB516A513; Fri, 12 Mar 2004 13:46:47 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A37343D3F; Fri, 12 Mar 2004 13:46:47 -0800 (PST) (envelope-from josef@FreeBSD.org) Received: from freefall.freebsd.org (josef@localhost [127.0.0.1]) i2CLklbv092265; Fri, 12 Mar 2004 13:46:47 -0800 (PST) (envelope-from josef@freefall.freebsd.org) Received: (from josef@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2CLklRM092261; Fri, 12 Mar 2004 13:46:47 -0800 (PST) (envelope-from josef) Date: Fri, 12 Mar 2004 13:46:47 -0800 (PST) From: Josef El-Rayes Message-Id: <200403122146.i2CLklRM092261@freefall.freebsd.org> To: josef@FreeBSD.org, freebsd-standards@FreeBSD.org, josef@FreeBSD.org Subject: Re: standards/63935: [patch] Fix C90 namespace pollution in X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 21:46:47 -0000 Synopsis: [patch] Fix C90 namespace pollution in Responsible-Changed-From-To: freebsd-standards->josef Responsible-Changed-By: josef Responsible-Changed-When: Fri Mar 12 13:46:29 PST 2004 Responsible-Changed-Why: i'll take this one http://www.freebsd.org/cgi/query-pr.cgi?pr=63935 From owner-freebsd-standards@FreeBSD.ORG Sat Mar 13 07:10:10 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A29D16A4CF for ; Sat, 13 Mar 2004 07:10:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42D3843D48 for ; Sat, 13 Mar 2004 07:10:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2DFAAbv018536 for ; Sat, 13 Mar 2004 07:10:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2DFAA1Q018535; Sat, 13 Mar 2004 07:10:10 -0800 (PST) (envelope-from gnats) Date: Sat, 13 Mar 2004 07:10:10 -0800 (PST) Message-Id: <200403131510.i2DFAA1Q018535@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Stefan Farfeleder Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan Farfeleder List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2004 15:10:10 -0000 The following reply was made to PR standards/56906; it has been noted by GNATS. From: Stefan Farfeleder To: Bruce Evans Cc: bug-followup@freebsd.org Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error Date: Sat, 13 Mar 2004 16:09:10 +0100 On Fri, Mar 12, 2004 at 11:21:41PM +1100, Bruce Evans wrote: > 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. Thanks, here's what the real C99 standard says: # 9 The macros # MATH_ERRNO # MATH_ERREXCEPT # expand to the integer constants 1 and 2, respectively; the macro # math_errhandling # expands to an expression that has type int and the value MATH_ERRNO, # MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is # constant for the duration of the program. It is unspecified whether # math_errhandling is a macro or an identifier with external linkage. If a macro # definition is suppressed or a program defines an identifier with the name # math_errhandling, the behavior is undefined. If the expression # math_errhandling & MATH_ERREXCEPT can be nonzero, the implementation # shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in # . Sounds like we definitely have to support MATH_ERREXCEPT since we don't do MATH_ERRNO (I still think setting math_errhandling to 0 in the meantime is a good idea). BTW, I think the macros FP_*, HUGE_VAL{F,L}, INFINITY, NAN, fpclassify(), is*() and signbit(), and the types double_t and type_t should be protected by #if __ISO_C_VISIBLE >= 1999 too. Similarly, lots of C99 prototypes aren't visible when__ISO_C_VISIBLE >= 1999. Cheers, Stefan