From owner-freebsd-bugs@FreeBSD.ORG Sat Jun 2 14:20:22 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A21D216A476 for ; Sat, 2 Jun 2007 14:20:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 593DF13C4CA for ; Sat, 2 Jun 2007 14:20:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l52EKIWf003323 for ; Sat, 2 Jun 2007 14:20:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l52EKIG7003322; Sat, 2 Jun 2007 14:20:18 GMT (envelope-from gnats) Resent-Date: Sat, 2 Jun 2007 14:20:18 GMT Resent-Message-Id: <200706021420.l52EKIG7003322@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kiyoshi Matsui Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96BDA16A481 for ; Sat, 2 Jun 2007 14:17:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 6EE3513C45D for ; Sat, 2 Jun 2007 14:17:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l52EHC6D097897 for ; Sat, 2 Jun 2007 14:17:12 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l52EHCdo097895; Sat, 2 Jun 2007 14:17:12 GMT (envelope-from nobody) Message-Id: <200706021417.l52EHCdo097895@www.freebsd.org> Date: Sat, 2 Jun 2007 14:17:12 GMT From: Kiyoshi Matsui To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: misc/113256: _limits.h for some CPU has wrong definitions of __UCHAR_MAX and __USHRT_MAX X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2007 14:20:22 -0000 >Number: 113256 >Category: misc >Synopsis: _limits.h for some CPU has wrong definitions of __UCHAR_MAX and __USHRT_MAX >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jun 02 14:20:18 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Kiyoshi Matsui >Release: none (I use FreeBSD 6.2 on i386) >Organization: none >Environment: none >Description: /usr/src/sys/amd64/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/amd64/include/_limits.h have wrong definitions of __UCHAR_MAX and __USHRT_MAX as: #define __UCHAR_MAX 0xffU #define __USHRT_MAX 0xffffU The following header files also have the same wrong definitions. /usr/src/sys/alpha/include/_limits.h /usr/src/sys/ia64/include/_limits.h /usr/src/sys/sparc64/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/ia64/include/_limits.h www.freebsd.org/cgi/cvsweb.cgi/src/sys/sparc64/include/_limits.h (alpha support was removed) These definitions may be used to define UCHAR_MAX and USHRT_MAX respectively, in /usr/include/limits.h, on the FreeBSD system of the corresponding CPU, hence UCHAR_MAX and USHRT_MAX are wrongly defined. My port devel/mcpp (mcpp-2.6.4) was reported to fail to be built on amd64: http://pointyhat.freebsd.org This is not a bug of mcpp, it is a bug of _limits.h of amd64 and others. >How-To-Repeat: >Fix: __UCHAR_MAX and __USHRT_MAX should be defined as: #define __UCHAR_MAX 0xff #define __USHRT_MAX 0xffff In other words, 'U' suffix of '0xffU' and '0xffffU' should be removed. On the other hand, the following headers have right definitions. /usr/include/machine/_limits.h on i386 system /usr/src/sys/i386/include/_limits.h and www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/include/_limits.h Also _limits.h for arm and sparc64 have right definitions of these macros as well as the one for i386. UCHAR_MAX and USHRT_MAX should be defined so as to be promoted to 'int', if 'int' can represent all the values of 'unsigned char' and 'unsigned short' respectively. These should not be promoted to 'unsigned int'. For further informations see the following document of mine. http://mcpp.svn.sourceforge.net/viewvc/*checkout*/mcpp/trunk/doc/cpp-test.html#5.1.3 >Release-Note: >Audit-Trail: >Unformatted: