summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/test/hwasan/TestCases/thread-uaf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/thread-uaf.c b/compiler-rt/test/hwasan/TestCases/thread-uaf.c
index 200b35a7964..33cea101878 100644
--- a/compiler-rt/test/hwasan/TestCases/thread-uaf.c
+++ b/compiler-rt/test/hwasan/TestCases/thread-uaf.c
@@ -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);
OpenPOWER on IntegriCloud