forked from OSchip/llvm-project
[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:
parent
c74b192404
commit
d49aaaf44f
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue