From owner-freebsd-bugs@FreeBSD.ORG Sat Feb 22 13:00:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D0E4552E for ; Sat, 22 Feb 2014 13:00:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AAB30152D for ; Sat, 22 Feb 2014 13:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s1MD000k003100 for ; Sat, 22 Feb 2014 13:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s1MD00Gk003097; Sat, 22 Feb 2014 13:00:00 GMT (envelope-from gnats) Resent-Date: Sat, 22 Feb 2014 13:00:00 GMT Resent-Message-Id: <201402221300.s1MD00Gk003097@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, "Ivan A. Kosarev" Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4525B2CE for ; Sat, 22 Feb 2014 12:52:07 +0000 (UTC) Received: from newred.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1797C14F1 for ; Sat, 22 Feb 2014 12:52:07 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by newred.freebsd.org (8.14.7/8.14.7) with ESMTP id s1MCq618097549 for ; Sat, 22 Feb 2014 12:52:06 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.7/8.14.7/Submit) id s1MCq6la097524; Sat, 22 Feb 2014 12:52:06 GMT (envelope-from nobody) Message-Id: <201402221252.s1MCq6la097524@cgiserv.freebsd.org> Date: Sat, 22 Feb 2014 12:52:06 GMT From: "Ivan A. Kosarev" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/186958: Incorrect definitions for platform-dependent types and macros X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Feb 2014 13:00:00 -0000 >Number: 186958 >Category: misc >Synopsis: Incorrect definitions for platform-dependent types and macros >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Feb 22 13:00:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Ivan A. Kosarev >Release: 9.2 >Organization: Access Softek, Inc >Environment: FreeBSD localhost 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013 root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Revision 232261: http://svnweb.freebsd.org/base?view=revision&revision=232261 address definition of some types, e.g, int64_t, on x64 FreeBSD when compiled in 32-bit mode. This bug report is about some other types and macros to fix to define them correctly in 32-bit mode. >How-To-Repeat: $ cat test.c #include #include #include #include #include #include #define PRINT(x) \ ((void) (printf(#x ": %d\n", (int) (x)))) int main(void) { PRINT(sizeof(long)); // width of target PRINT(sizeof(int64_t)) ; // '__int64_t' of PRINT(sizeof(INT64_C(0))); // 'INT64_C()' of PRINT(sizeof(UINT64_C(0))); // 'UINT64_C()' of PRINT(sizeof(intptr_t)) ; // '__intptr_t' of PRINT(sizeof(INTPTR_MIN)); // 'INTPTR_MIN' of PRINT(sizeof(INTPTR_MAX)); // 'INTPTR_MAX' of PRINT(sizeof(uintptr_t)) ; // '__uintptr_t' of PRINT(sizeof(UINTPTR_MAX)); // 'UINTPTR_MAX' of PRINT(sizeof(ptrdiff_t)) ; // '__ptrdiff_t' of PRINT(sizeof(PTRDIFF_MIN)); // 'PTRDIFF_MIN' of PRINT(sizeof(PTRDIFF_MAX)); // 'PTRDIFF_MIN' of PRINT(sizeof(size_t)); // '__size_t' of PRINT(sizeof(SIZE_MAX)); // 'SIZE_MAX' of PRINT(sizeof(__intfptr_t)); // '__intfptr_t' of PRINT(sizeof(__uintfptr_t)); // '__uintfptr_t' of PRINT(sizeof(__ssize_t)); // '__ssize_t' of PRINT(sizeof(id_t)); // '__id_t' of PRINT(sizeof(time_t)); // '__time_t' of return EXIT_SUCCESS; } $ gcc -m32 -B/usr/lib32 test.c && ./a.out sizeof(long): 4 sizeof(int64_t): 8 sizeof(INT64_C(0)): 4 sizeof(UINT64_C(0)): 4 sizeof(intptr_t): 4 sizeof(INTPTR_MIN): 8 sizeof(INTPTR_MAX): 8 sizeof(uintptr_t): 4 sizeof(UINTPTR_MAX): 8 sizeof(ptrdiff_t): 4 sizeof(PTRDIFF_MIN): 8 sizeof(PTRDIFF_MAX): 8 sizeof(size_t): 4 sizeof(SIZE_MAX): 8 sizeof(__intfptr_t): 4 sizeof(__uintfptr_t): 4 sizeof(__ssize_t): 4 sizeof(id_t): 8 sizeof(time_t): 4 Expected output: sizeof(long): 4 sizeof(int64_t): 8 sizeof(INT64_C(0)): 8 sizeof(UINT64_C(0)): 8 sizeof(intptr_t): 4 sizeof(INTPTR_MIN): 4 sizeof(INTPTR_MAX): 4 sizeof(uintptr_t): 4 sizeof(UINTPTR_MAX): 4 sizeof(ptrdiff_t): 4 sizeof(PTRDIFF_MIN): 4 sizeof(PTRDIFF_MAX): 4 sizeof(size_t): 4 sizeof(SIZE_MAX): 4 sizeof(__ssize_t): 4 sizeof(id_t): 4 sizeof(time_t): 4 Things to fix: sizeof(INT64_C(0)) sizeof(UINT64_C(0)) sizeof(INTPTR_MIN) sizeof(INTPTR_MAX) sizeof(UINTPTR_MAX) sizeof(PTRDIFF_MIN) sizeof(PTRDIFF_MAX) sizeof(SIZE_MAX) sizeof(id_t) >Fix: >Release-Note: >Audit-Trail: >Unformatted: