1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
7 uint64_t objs
[8*3*3*2][3];
10 void __tsan_unaligned_read2(void *addr
);
11 void __tsan_unaligned_read4(void *addr
);
12 void __tsan_unaligned_read8(void *addr
);
13 void __tsan_unaligned_write2(void *addr
);
14 void __tsan_unaligned_write4(void *addr
);
15 void __tsan_unaligned_write8(void *addr
);
18 static void access(char *p
, int sz
, int rw
) {
21 case 0: __tsan_unaligned_write2(p
); break;
22 case 1: __tsan_unaligned_write4(p
); break;
23 case 2: __tsan_unaligned_write8(p
); break;
28 case 0: __tsan_unaligned_read2(p
); break;
29 case 1: __tsan_unaligned_read4(p
); break;
30 case 2: __tsan_unaligned_read8(p
); break;
36 static int accesssize(int sz
) {
45 void Test(bool main
) {
46 uint64_t *obj
= objs
[0];
47 for (int off
= 0; off
< 8; off
++) {
48 for (int sz1
= 0; sz1
< 3; sz1
++) {
49 for (int sz2
= 0; sz2
< 3; sz2
++) {
50 for (int rw
= 0; rw
< 2; rw
++) {
51 char *p
= (char*)obj
+ off
;
53 // printf("thr=%d off=%d sz1=%d sz2=%d rw=%d p=%p\n",
54 // main, off, sz1, sz2, rw, p);
58 // printf("thr=%d off=%d sz1=%d sz2=%d rw=%d p=%p\n",
59 // main, off, sz1, sz2, rw, p);
69 void *Thread(void *p
) {
77 pthread_create(&th
, 0, Thread
, 0);
80 fprintf(stderr
, "OK\n");
83 // CHECK-NOT: WARNING: ThreadSanitizer: