From d1dc9cf655f283cf9a8b12f11b6cca7eb5d7a55e Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 19 Dec 2014 15:16:47 -0800 Subject: [PATCH] stdint.h: use correct type for INT64_MAX (#11647) int64_t is signed. Although it does not make a difference by itself, because INT64_MAX is still a valid number for uint64_t (UL), the later INT64_MIN declaration depends on INT64_MAX, and therefore got implicitly casted to unsigned type. This fixes the following program on a x86_64 system: #include int main() { int64_t test = 5; if (test < INT64_MIN) return 1; return 0; } This is a regression since commit 1d13a609 ("stdint.h: define [U]INT64[MAX|MIN] with [U]L on x86_64"). Signed-off-by: Jerome Duval --- headers/posix/stdint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/headers/posix/stdint.h b/headers/posix/stdint.h index 03e66957bc..b90fca2109 100644 --- a/headers/posix/stdint.h +++ b/headers/posix/stdint.h @@ -70,10 +70,10 @@ typedef uint64_t uintmax_t; #define UINT32_MAX (4294967295U) #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ > 4 -#define INT64_MAX (9223372036854775807UL) +#define INT64_MAX (9223372036854775807L) #define UINT64_MAX (18446744073709551615UL) #else -#define INT64_MAX (9223372036854775807ULL) +#define INT64_MAX (9223372036854775807LL) #define UINT64_MAX (18446744073709551615ULL) #endif #define INT64_MIN (-INT64_MAX-1)