diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2012-05-14 14:00:07 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2012-05-14 14:00:07 +0000 |
| commit | fa44dc56231a4aeb5b6f932b32ba61d78cae1876 (patch) | |
| tree | b8d75fa6680efa902b8d73f3c1af8cdf72b73fc4 | |
| parent | 3dea421826ff4d793de8515bb062a62fd32e0185 (diff) | |
| download | bcm5719-llvm-fa44dc56231a4aeb5b6f932b32ba61d78cae1876.tar.gz bcm5719-llvm-fa44dc56231a4aeb5b6f932b32ba61d78cae1876.zip | |
tsan: update output tests to race on heap memory
Races on stack of main thread are problematic for COMPAT mapping, because it's not 1-to-1 and race addr is not properly mapped from shadow back to application memory.
Update output tests to race heap memory.
llvm-svn: 156758
| -rw-r--r-- | compiler-rt/lib/tsan/output_tests/mop_with_offset.cc | 11 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/output_tests/mop_with_offset2.cc | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/compiler-rt/lib/tsan/output_tests/mop_with_offset.cc b/compiler-rt/lib/tsan/output_tests/mop_with_offset.cc index c785de3a799..fc497bfb4a7 100644 --- a/compiler-rt/lib/tsan/output_tests/mop_with_offset.cc +++ b/compiler-rt/lib/tsan/output_tests/mop_with_offset.cc @@ -17,14 +17,15 @@ void *Thread2(void *x) { } int main() { - int data = 42; - fprintf(stderr, "ptr1=%p\n", &data); - fprintf(stderr, "ptr2=%p\n", (char*)&data + 2); + int *data = new int(42); + fprintf(stderr, "ptr1=%p\n", data); + fprintf(stderr, "ptr2=%p\n", (char*)data + 2); pthread_t t[2]; - pthread_create(&t[0], NULL, Thread1, &data); - pthread_create(&t[1], NULL, Thread2, &data); + pthread_create(&t[0], NULL, Thread1, data); + pthread_create(&t[1], NULL, Thread2, data); pthread_join(t[0], NULL); pthread_join(t[1], NULL); + delete data; } // CHECK: ptr1=[[PTR1:0x[0-9,a-f]+]] diff --git a/compiler-rt/lib/tsan/output_tests/mop_with_offset2.cc b/compiler-rt/lib/tsan/output_tests/mop_with_offset2.cc index 8c0ec072557..bbeda554929 100644 --- a/compiler-rt/lib/tsan/output_tests/mop_with_offset2.cc +++ b/compiler-rt/lib/tsan/output_tests/mop_with_offset2.cc @@ -17,14 +17,15 @@ void *Thread2(void *x) { } int main() { - int data = 42; - fprintf(stderr, "ptr1=%p\n", &data); - fprintf(stderr, "ptr2=%p\n", (char*)&data + 2); + int *data = new int(42); + fprintf(stderr, "ptr1=%p\n", data); + fprintf(stderr, "ptr2=%p\n", (char*)data + 2); pthread_t t[2]; - pthread_create(&t[0], NULL, Thread1, &data); - pthread_create(&t[1], NULL, Thread2, &data); + pthread_create(&t[0], NULL, Thread1, data); + pthread_create(&t[1], NULL, Thread2, data); pthread_join(t[0], NULL); pthread_join(t[1], NULL); + delete data; } // CHECK: ptr1=[[PTR1:0x[0-9,a-f]+]] |

