[memprof] Fix UB.

An infinite loop without any effects is illegal C++ and can be optimized
away by the compiler.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D119575
This commit is contained in:
Florian Mayer 2022-02-11 12:21:19 -08:00
parent c74b192404
commit d49aaaf44f
2 changed files with 4 additions and 1 deletions

View File

@ -45,7 +45,9 @@ static void AsanDie() {
static atomic_uint32_t num_calls;
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
// Don't die twice - run a busy loop.
while (1) { }
while (1) {
internal_sched_yield();
}
}
if (common_flags()->print_module_map >= 1)
DumpProcessMap();

View File

@ -39,6 +39,7 @@ static void MemprofDie() {
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
// Don't die twice - run a busy loop.
while (1) {
internal_sched_yield();
}
}
if (common_flags()->print_module_map >= 1)