misc/186247: <machine/_types.h> defines int64_t/uint64_t incorrectly
Ivan A. Kosarev
ikosarev at accesssoftek.com
Wed Jan 29 17:20:00 UTC 2014
>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: open
>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:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list