From owner-freebsd-standards@FreeBSD.ORG Mon Dec 29 11:04:33 2003 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 49B1216A4CE for ; Mon, 29 Dec 2003 11:04:33 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5092543D6A for ; Mon, 29 Dec 2003 11:02:33 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) hBTJ2XFR041265 for ; Mon, 29 Dec 2003 11:02:33 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBTJ2Wns041258 for freebsd-standards@freebsd.org; Mon, 29 Dec 2003 11:02:32 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 29 Dec 2003 11:02:32 -0800 (PST) Message-Id: <200312291902.hBTJ2Wns041258@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, 29 Dec 2003 19:04:33 -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 [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/06/20] standards/53554standards interval timers not cleared in fork() 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 8 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2001/01/16] bin/24390 standards Replacing old dir-symlinks when using /bi 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/04/22] standards/51292standards [PATCH] add ecvt()/fcvt()/gcvt() function 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 22 problems total. From owner-freebsd-standards@FreeBSD.ORG Mon Dec 29 11:07:25 2003 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 1AB7F16A4CE for ; Mon, 29 Dec 2003 11:07:25 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3909143DB0 for ; Mon, 29 Dec 2003 11:06:19 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.10/8.12.10) with ESMTP id hBTJ4sFR044226 for ; Mon, 29 Dec 2003 11:04:54 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBTJ4rrw044220 for standards@freebsd.org; Mon, 29 Dec 2003 11:04:53 -0800 (PST) (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 29 Dec 2003 11:04:53 -0800 (PST) Message-Id: <200312291904.hBTJ4rrw044220@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: 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, 29 Dec 2003 19:07:25 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2001/08/18] kern/29844 standards [PATCH] setpgrp does not behave as manual 1 problem total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2001/03/05] bin/25542 standards /bin/sh: null char in quoted string 1 problem 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 s [2001/06/18] kern/28260 standards UIO_MAXIOV needs to be made public 4 problems total. From owner-freebsd-standards@FreeBSD.ORG Wed Dec 31 16:50:16 2003 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 9749816A4CE for ; Wed, 31 Dec 2003 16:50:16 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6169A43D1F for ; Wed, 31 Dec 2003 16:50:14 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i010oEFR028844 for ; Wed, 31 Dec 2003 16:50:14 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i010oE0D028843; Wed, 31 Dec 2003 16:50:14 -0800 (PST) (envelope-from gnats) Resent-Date: Wed, 31 Dec 2003 16:50:14 -0800 (PST) Resent-Message-Id: <200401010050.i010oE0D028843@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, Jason Evans Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A79316A4CE for ; Wed, 31 Dec 2003 16:40:31 -0800 (PST) Received: from canonware.com (dslh174.fsr.net [12.32.33.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4573843D1D for ; Wed, 31 Dec 2003 16:40:30 -0800 (PST) (envelope-from jasone@canonware.com) Received: by canonware.com (Postfix, from userid 1001) id 19C541C5; Wed, 31 Dec 2003 16:40:57 -0800 (PST) Message-Id: <20040101004057.19C541C5@canonware.com> Date: Wed, 31 Dec 2003 16:40:57 -0800 (PST) From: Jason Evans To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: standards/60772: _Bool and bool should be unsigned X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jason Evans List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2004 00:50:16 -0000 >Number: 60772 >Category: standards >Synopsis: _Bool and bool should be unsigned >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 31 16:50:14 PST 2003 >Closed-Date: >Last-Modified: >Originator: Jason Evans >Release: FreeBSD 4.9-RC i386 >Organization: >Environment: System: FreeBSD canonware.com 4.9-RC FreeBSD 4.9-RC #12: Fri Oct 17 22:15:36 PDT 2003 jasone@canonware.com:/usr/src/sys/compile/CANONWARE i386 >Description: _Bool and bool must be unsigned, so that structure bit fields work as expected. >How-To-Repeat: #include #include /* _Bool and bool must be unsigned. Otherwise, stucture bit fields do not work * correctly, due to how sign extension works. */ struct foo { bool white:1; /* Note :1 (bit field). */ }; struct bar { bool white:2; }; int main(void) { struct foo foo; struct bar bar; bool white; foo.white = false; fprintf(stderr, "%u (expect 0)\n", foo.white); fprintf(stderr, "%u (expect 1)\n", !foo.white); foo.white = !foo.white; /* Breaks. */ fprintf(stderr, "%u (expect 1)\n", foo.white); fprintf(stderr, "%u (expect 0)\n", !foo.white); bar.white = false; fprintf(stderr, "%u (expect 0)\n", bar.white); fprintf(stderr, "%u (expect 1)\n", !bar.white); bar.white = !bar.white; fprintf(stderr, "%u (expect 1)\n", bar.white); fprintf(stderr, "%u (expect 0)\n", !bar.white); white = false; fprintf(stderr, "%u (expect 0)\n", white); fprintf(stderr, "%u (expect 1)\n", !white); white = !white; fprintf(stderr, "%u (expect 1)\n", white); fprintf(stderr, "%u (expect 0)\n", !white); return 0; } >Fix: Using bit fields with more than one bit works around the problem, but is not a satisfactory workaround. This bug can cause obscure problems, since something like: if (foo.white == true) ...; breaks. >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-standards@FreeBSD.ORG Wed Dec 31 20:57:16 2003 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 373DA16A4CE; Wed, 31 Dec 2003 20:57:16 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6426043D4C; Wed, 31 Dec 2003 20:57:13 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id PAA09351; Thu, 1 Jan 2004 15:52:09 +1100 Date: Thu, 1 Jan 2004 15:52:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Jason Evans In-Reply-To: <20040101004057.19C541C5@canonware.com> Message-ID: <20040101153143.N7624@gamplex.bde.org> References: <20040101004057.19C541C5@canonware.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: FreeBSD-gnats-submit@freebsd.org cc: freebsd-standards@freebsd.org Subject: Re: standards/60772: _Bool and bool should be unsigned 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: Thu, 01 Jan 2004 04:57:16 -0000 On Wed, 31 Dec 2003, Jason Evans wrote: > >Release: FreeBSD 4.9-RC i386 ^^^^^^^^^^^ > >Description: > _Bool and bool must be unsigned, so that structure bit fields work as > expected. > >How-To-Repeat: > #include > #include > > /* _Bool and bool must be unsigned. Otherwise, stucture bit fields do not work > * correctly, due to how sign extension works. */ > > struct foo { > bool white:1; /* Note :1 (bit field). */ > }; This works correctly with C99 compilers, e.g., in with the not-quite-C99 compiler gcc in -current and even with the non-C99 compiler "gcc -c89" in -current, since bool is an alias for _Bool and _Bool is a builtin type (neither signed nor unsigned) that can only represent the values 0 and 1. > > struct bar { > bool white:2; > }; This also doesn't really work in FreeBSD-4.9, since it can store more than the values of 0 and 1. Similarly for a non-bitfield. The fake definition in FreeBSD-4.9 permits storing values between INT_MIN and INT_MAX, and changing it to unsigned so that it is limited to values between 0 and UINT_MAX isn't much of an improvment. > >Fix: > Using bit fields with more than one bit works around the problem, but is > not a satisfactory workaround. This bug can cause obscure problems, since > something like: > > if (foo.white == true) ...; > > breaks. I think the correct fix is to remove in RELENG_4, since it is impossible to implement it correctly. It's more dangerous than it used to be since programs that use it are more likely to expect it to give C99 semantics. Was there a defacto standard for it before C99? It doesn't seem to have been very common -- it isn't in glibc-2.2.5 (which is 2 years old, but not as old as in FreeBSD). Bruce From owner-freebsd-standards@FreeBSD.ORG Wed Dec 31 21:00:40 2003 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 3261C16A4CE for ; Wed, 31 Dec 2003 21:00:40 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDD4643D48 for ; Wed, 31 Dec 2003 21:00:38 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i0150cFR047144 for ; Wed, 31 Dec 2003 21:00:38 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i0150cVL047143; Wed, 31 Dec 2003 21:00:38 -0800 (PST) (envelope-from gnats) Date: Wed, 31 Dec 2003 21:00:38 -0800 (PST) Message-Id: <200401010500.i0150cVL047143@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Bruce Evans Subject: Re: standards/60772: _Bool and bool should be unsigned 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: Thu, 01 Jan 2004 05:00:40 -0000 The following reply was made to PR standards/60772; it has been noted by GNATS. From: Bruce Evans To: Jason Evans Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-standards@freebsd.org Subject: Re: standards/60772: _Bool and bool should be unsigned Date: Thu, 1 Jan 2004 15:52:08 +1100 (EST) On Wed, 31 Dec 2003, Jason Evans wrote: > >Release: FreeBSD 4.9-RC i386 ^^^^^^^^^^^ > >Description: > _Bool and bool must be unsigned, so that structure bit fields work as > expected. > >How-To-Repeat: > #include > #include > > /* _Bool and bool must be unsigned. Otherwise, stucture bit fields do not work > * correctly, due to how sign extension works. */ > > struct foo { > bool white:1; /* Note :1 (bit field). */ > }; This works correctly with C99 compilers, e.g., in with the not-quite-C99 compiler gcc in -current and even with the non-C99 compiler "gcc -c89" in -current, since bool is an alias for _Bool and _Bool is a builtin type (neither signed nor unsigned) that can only represent the values 0 and 1. > > struct bar { > bool white:2; > }; This also doesn't really work in FreeBSD-4.9, since it can store more than the values of 0 and 1. Similarly for a non-bitfield. The fake definition in FreeBSD-4.9 permits storing values between INT_MIN and INT_MAX, and changing it to unsigned so that it is limited to values between 0 and UINT_MAX isn't much of an improvment. > >Fix: > Using bit fields with more than one bit works around the problem, but is > not a satisfactory workaround. This bug can cause obscure problems, since > something like: > > if (foo.white == true) ...; > > breaks. I think the correct fix is to remove in RELENG_4, since it is impossible to implement it correctly. It's more dangerous than it used to be since programs that use it are more likely to expect it to give C99 semantics. Was there a defacto standard for it before C99? It doesn't seem to have been very common -- it isn't in glibc-2.2.5 (which is 2 years old, but not as old as in FreeBSD). Bruce