Date: Wed, 29 Jan 2014 17:15:51 GMT From: "Ivan A. Kosarev" <ikosarev@accesssoftek.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/186247: <machine/_types.h> defines int64_t/uint64_t incorrectly Message-ID: <201401291715.s0THFpZI026350@oldred.freebsd.org> Resent-Message-ID: <201401291720.s0THK0i8007341@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401291715.s0THFpZI026350>
