llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.42k stars 12.16k forks source link

[Bug]: error: ran out of registers during register allocation with -fsanitize=address and -target armv7-unknown-linux #98222

Open appujee opened 4 months ago

appujee commented 4 months ago

The code is pretty big as I haven't spent enough time reducing it. But the repro test case can be found here:

https://godbolt.org/z/WafcG8G95

$ clang++ -std=c++20 -target armv7-unknown-linux -fsanitize=address -mllvm -asan-use-stack-safety=0

appujee commented 4 months ago

Related discussion in https://github.com/android/ndk/issues/2030

llvmbot commented 4 months ago

@llvm/issue-subscribers-backend-arm

Author: None (appujee)

The code is pretty big as I haven't spent enough time reducing it. But the repro test case can be found here: https://godbolt.org/z/WafcG8G95 $ clang++ -std=c++20 -target armv7-unknown-linux -fsanitize=address -mllvm -asan-use-stack-safety=0
ostannard commented 4 months ago

Reduced down to this, which gives the same error with -asan-use-stack-safety=0 and -asan-use-stack-safety=1:

template <class b> b *addressof(b &);

void bc() {
  _Atomic(long long) bd;
  __c11_atomic_store(addressof(bd), 0, 0);
}

void m_fn2(long long p1) { bc(); }
$ /work/llvm/build/bin/clang  -std=c++20 -target armv7-unknown-linux -fsanitize=address -c out-of-regs.cpp
clang: warning: unknown platform, assuming -mfloat-abi=soft
clang: warning: unknown platform, assuming -mfloat-abi=soft
clang: warning: unknown platform, assuming -mfloat-abi=soft
error: ran out of registers during register allocation
1 error generated.