misc/186958: Incorrect definitions for platform-dependent types and macros
Ivan A. Kosarev
ikosarev at accesssoftek.com
Sat Feb 22 13:00:00 UTC 2014
>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 at 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 <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#include <sys/wait.h>
#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 <machine/_types.h>
PRINT(sizeof(INT64_C(0))); // 'INT64_C()' of <machine/_stdint.h>
PRINT(sizeof(UINT64_C(0))); // 'UINT64_C()' of <machine/_stdint.h>
PRINT(sizeof(intptr_t)) ; // '__intptr_t' of <machine/_types.h>
PRINT(sizeof(INTPTR_MIN)); // 'INTPTR_MIN' of <machine/_stdint.h>
PRINT(sizeof(INTPTR_MAX)); // 'INTPTR_MAX' of <machine/_stdint.h>
PRINT(sizeof(uintptr_t)) ; // '__uintptr_t' of <machine/_types.h>
PRINT(sizeof(UINTPTR_MAX)); // 'UINTPTR_MAX' of <machine/_stdint.h>
PRINT(sizeof(ptrdiff_t)) ; // '__ptrdiff_t' of <machine/_types.h>
PRINT(sizeof(PTRDIFF_MIN)); // 'PTRDIFF_MIN' of <machine/_stdint.h>
PRINT(sizeof(PTRDIFF_MAX)); // 'PTRDIFF_MIN' of <machine/_stdint.h>
PRINT(sizeof(size_t)); // '__size_t' of <machine/_types.h>
PRINT(sizeof(SIZE_MAX)); // 'SIZE_MAX' of <machine/_stdint.h>
PRINT(sizeof(__intfptr_t)); // '__intfptr_t' of <machine/_types.h>
PRINT(sizeof(__uintfptr_t)); // '__uintfptr_t' of <machine/_types.h>
PRINT(sizeof(__ssize_t)); // '__ssize_t' of <machine/_types.h>
PRINT(sizeof(id_t)); // '__id_t' of <sys/_types.h>
PRINT(sizeof(time_t)); // '__time_t' of <machine/_types.h>
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:
More information about the freebsd-bugs
mailing list