From nobody@FreeBSD.org  Wed Jan 29 17:15:52 2014
Return-Path: <nobody@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 20A43495
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 17:15:52 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.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 0D22C10E3
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 17:15:52 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0THFpIT026358
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 17:15:51 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0THFpZI026350;
	Wed, 29 Jan 2014 17:15:51 GMT
	(envelope-from nobody)
Message-Id: <201401291715.s0THFpZI026350@oldred.freebsd.org>
Date: Wed, 29 Jan 2014 17:15:51 GMT
From: "Ivan A. Kosarev" <ikosarev@accesssoftek.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: <machine/_types.h> defines int64_t/uint64_t incorrectly
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         186247
>Category:       misc
>Synopsis:       <machine/_types.h> defines int64_t/uint64_t incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          patched
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 29 17:20:00 UTC 2014
>Closed-Date:    
>Last-Modified:  Fri Feb 21 19:25:52 UTC 2014
>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:
The file:

/usr/include/machine/_types.h

reads:

typedef long __int64_t;
typedef unsigned long __uint64_t;

This causes types int64_t and uint64_t be of width 32 when being compiled in the 32-bit mode.
>How-To-Repeat:
$ cat x.c
#include <stdio.h>
#include <stdint.h>

int main(void)
{
    printf("%d\n", sizeof(uint64_t));
    return 0;
}
$ gcc -m32 -B/usr/lib32 x.c
$ ./a.out
4
>Fix:
These definitions:

typedef long __int64_t;
typedef unsigned long __uint64_t;

should be replaced with something like:

#if defined(__LP64__)
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
#endif


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: emaste 
State-Changed-When: Fri Feb 21 19:25:11 UTC 2014 
State-Changed-Why:  
amd64 and i386 _types.h merged into x86/_types.h in r232261 
http://svnweb.freebsd.org/base?view=revision&revision=232261 


http://www.freebsd.org/cgi/query-pr.cgi?pr=186247 
>Unformatted:
