-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
Description
llvm-project/libc/src/__support/threads/linux/thread.cpp fails to compile for me with gcc-14:
In file included from /android0/llvm-project/libc/src/__support/CPP/type_traits/integral_constant.h:11,
from /android0/llvm-project/libc/src/__support/CPP/type_traits/has_unique_object_representations.h:11,
from /android0/llvm-project/libc/src/__support/CPP/atomic.h:12,
from /android0/llvm-project/libc/src/__support/threads/thread.h:12,
from /android0/llvm-project/libc/src/__support/threads/linux/thread.cpp:9:
In function ‘long int __llvm_libc_20_0_0_git::syscall_impl(long int, long int, long int)’,
inlined from ‘R __llvm_libc_20_0_0_git::syscall_impl(long int, Ts ...) [with R = long int; Ts = {void*, long unsigned int}]’ at /android0/llvm-project/libc/src/__support/OSUtil/linux/syscall.h:34:49,
inlined from ‘void __llvm_libc_20_0_0_git::free_stack(void*, size_t, size_t)’ at /android0/llvm-project/libc/src/__support/threads/linux/thread.cpp:128:37,
inlined from ‘void __llvm_libc_20_0_0_git::cleanup_thread_resources(ThreadAttributes*)’ at /android0/llvm-project/libc/src/__support/threads/linux/thread.cpp:153:15,
inlined from ‘int __llvm_libc_20_0_0_git::Thread::run(__llvm_libc_20_0_0_git::ThreadStyle, __llvm_libc_20_0_0_git::ThreadRunner, void*, void*, size_t, size_t, bool)’ at /android0/llvm-project/libc/src/__support/threads/linux/thread.cpp:335:29:
/android0/llvm-project/libc/src/__support/macros/attributes.h:28:25: error: ‘asm’ operand has impossible constraints or there are not enough registers
28 | #define LIBC_INLINE_ASM __asm__ __volatile__
| ^~~~~~~
/android0/llvm-project/libc/src/__support/OSUtil/linux/x86_64/syscall.h:39:3: note: in expansion of macro ‘LIBC_INLINE_ASM’
39 | LIBC_INLINE_ASM("syscall"
| ^~~~~~~~~~~~~~~
If I change the arity-2 syscall to use just asm rather than LIBC_INLINE_ASM (removing the volatile qualifier), we do not observe register exhaustion. It's not immediately clear why that would fail; only with gcc and only with newer gcc, but I've been of the opinion that LIBC_INLINE_ASM needs to die. I'd rather put [[nodiscard]] on our syscall wrappers. Found while trying to test #124036.