forked from OSchip/llvm-project
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
This commit is contained in:
parent
3dea421826
commit
fa44dc5623
|
@ -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]+]]
|
||||
|
|
|
@ -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]+]]
|
||||
|
|
Loading…
Reference in New Issue