From: Dmitry Vyukov Date: Tue, 8 Jul 2014 13:36:59 +0000 (+0000) Subject: tsan: fix a potential hang X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edbb54d60c98cd5d99d90ad614642c80664bd9e0;p=platform%2Fupstream%2Fllvm.git tsan: fix a potential hang idx0 is not updated in the branch, so if we take that branch idx0 will stay updated forever llvm-svn: 212532 --- diff --git a/compiler-rt/lib/tsan/rtl/tsan_sync.cc b/compiler-rt/lib/tsan/rtl/tsan_sync.cc index 3952b2f..3462b04 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_sync.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_sync.cc @@ -133,7 +133,7 @@ SyncVar* MetaMap::GetAndLock(ThreadState *thr, uptr pc, u32 myidx = 0; SyncVar *mys = 0; for (;;) { - u32 idx = *meta; + u32 idx = idx0; for (;;) { if (idx == 0) break; @@ -156,8 +156,10 @@ SyncVar* MetaMap::GetAndLock(ThreadState *thr, uptr pc, } if (!create) return 0; - if (*meta != idx0) + if (*meta != idx0) { + idx0 = *meta; continue; + } if (myidx == 0) { const u64 uid = atomic_fetch_add(&uid_gen_, 1, memory_order_relaxed);