[compiler-rt] r341480 - [hwasan] deflake a test

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 09:09:53 PDT 2018


Author: kcc
Date: Wed Sep  5 09:09:53 2018
New Revision: 341480

URL: http://llvm.org/viewvc/llvm-project?rev=341480&view=rev
Log:
[hwasan] deflake a test 

Modified:
    compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c

Modified: compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c?rev=341480&r1=341479&r2=341480&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/thread-uaf.c Wed Sep  5 09:09:53 2018
@@ -19,7 +19,6 @@ void *Allocate(void *arg) {
   return NULL;
 }
 void *Deallocate(void *arg) {
-  while (__sync_fetch_and_add(&state, 0) != 1) {}
   free(x);
   __sync_fetch_and_add(&state, 1);
   while (__sync_fetch_and_add(&state, 0) != 3) {}
@@ -27,7 +26,6 @@ void *Deallocate(void *arg) {
 }
 
 void *Use(void *arg) {
-  while (__sync_fetch_and_add(&state, 0) != 2) {}
   x[5] = 42;
   // CHECK: ERROR: HWAddressSanitizer: tag-mismatch on address
   // CHECK: WRITE of size 1 {{.*}} in thread T3
@@ -47,7 +45,9 @@ int main() {
   pthread_t t1, t2, t3;
 
   pthread_create(&t1, NULL, Allocate, NULL);
+  while (__sync_fetch_and_add(&state, 0) != 1) {}
   pthread_create(&t2, NULL, Deallocate, NULL);
+  while (__sync_fetch_and_add(&state, 0) != 2) {}
   pthread_create(&t3, NULL, Use, NULL);
 
   pthread_join(t1, NULL);




More information about the llvm-commits mailing list