[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 Jan 2025 08:10:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283917 Bug ID: 283917 Summary: libc failes to include stdint.h with clang>16 and -ffreestanding Product: Base System Version: 14.2-STABLE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: standards Assignee: standards@FreeBSD.org Reporter: keve@keve.hu The trivial code ``` #include <inttypes.h> #include <stdint.h> #include <stdio.h> int main(const int argc, const char *argv[]) { uint32_t answer = 42; printf("%" PRId32 "\n", answer); return 0; } ``` fails to compile with clang17, clang18, clang19, when -ffreestanding is set ``` # env CC=clang19 CFLAGS=-ffreestanding make hello clang19 -ffreestanding hello.c -o hello In file included from hello.c:2: /usr/local/llvm19/lib/clang/19/include/stdint.h:261:25: error: typedef redefinition with different types ('int16_t' (aka 'short') vs '__int_fast16_t' (aka 'int')) 261 | typedef __int_least16_t int_fast16_t; | ^ /usr/include/sys/stdint.h:51:25: note: previous definition is here 51 | typedef __int_fast16_t int_fast16_t; | ^ In file included from hello.c:2: /usr/local/llvm19/lib/clang/19/include/stdint.h:262:26: error: typedef redefinition with different types ('uint16_t' (aka 'unsigned short') vs '__uint_fast16_t' (aka 'unsigned int')) 262 | typedef __uint_least16_t uint_fast16_t; | ^ /usr/include/sys/stdint.h:56:26: note: previous definition is here 56 | typedef __uint_fast16_t uint_fast16_t; | ^ In file included from hello.c:2: /usr/local/llvm19/lib/clang/19/include/stdint.h:280:24: error: typedef redefinition with different types ('int8_t' (aka 'signed char') vs '__int_fast8_t' (aka 'int')) 280 | typedef __int_least8_t int_fast8_t; | ^ /usr/include/sys/stdint.h:50:24: note: previous definition is here 50 | typedef __int_fast8_t int_fast8_t; | ^ In file included from hello.c:2: /usr/local/llvm19/lib/clang/19/include/stdint.h:281:25: error: typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs '__uint_fast8_t' (aka 'unsigned int')) 281 | typedef __uint_least8_t uint_fast8_t; | ^ /usr/include/sys/stdint.h:55:25: note: previous definition is here 55 | typedef __uint_fast8_t uint_fast8_t; | ^ 4 errors generated. *** Error code 1 ``` Other environments (e.g. Linux, Darwin) compile this code just fine with -ffreestanding. A real life project affected by this is e.g. libecc (https://github.com/libecc/libecc) -- You are receiving this mail because: You are the assignee for the bug.