clang, don't optimize me 🚨

avoid ClearStack function being optimized in release builds
This commit is contained in:
Vinicius Rangel 2025-05-03 15:34:13 -03:00
parent 3f9f7adae4
commit 108f96096b
No known key found for this signature in database
GPG Key ID: A5B154D904B761D9

View File

@ -44,9 +44,9 @@ Tcb* GetTcbBase();
void EnsureThreadInitialized();
template <size_t size>
void ClearStack() {
void* buf = alloca(size);
memset(buf, 0, size);
__attribute__((optnone)) void ClearStack() {
volatile void* buf = alloca(size);
memset(const_cast<void*>(buf), 0, size);
buf = nullptr;
}