summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/tsan/lit_tests/global_race.cc23
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_report.cc2
2 files changed, 21 insertions, 4 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/global_race.cc b/compiler-rt/lib/tsan/lit_tests/global_race.cc
index 997f0503dee..3e26792d8d6 100644
--- a/compiler-rt/lib/tsan/lit_tests/global_race.cc
+++ b/compiler-rt/lib/tsan/lit_tests/global_race.cc
@@ -4,22 +4,39 @@
#include <stddef.h>
int GlobalData[10];
+int y;
+namespace XXX {
+ struct YYY {
+ static int ZZZ[10];
+ };
+ int YYY::ZZZ[10];
+}
void *Thread(void *a) {
GlobalData[2] = 42;
+ y = 1;
+ XXX::YYY::ZZZ[0] = 1;
return 0;
}
int main() {
fprintf(stderr, "addr=%p\n", GlobalData);
+ fprintf(stderr, "addr2=%p\n", &y);
+ fprintf(stderr, "addr3=%p\n", XXX::YYY::ZZZ);
pthread_t t;
pthread_create(&t, 0, Thread, 0);
GlobalData[2] = 43;
+ y = 0;
+ XXX::YYY::ZZZ[0] = 0;
pthread_join(t, 0);
}
// CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
+// CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]]
+// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]]
+// CHECK: WARNING: ThreadSanitizer: data race
+// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}})
+// CHECK: WARNING: ThreadSanitizer: data race
+// CHECK: Location is global 'y' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}})
// CHECK: WARNING: ThreadSanitizer: data race
-// Requires llvm-symbolizer, so disabled for now.
-// CHECK0: Location is global 'GlobalData' of size 40 at [[ADDR]]
-// CHECK0: (global_race.cc.exe+0x[0-9,a-f]+)
+// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}})
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc
index bae7040831e..66307ae09dc 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc
@@ -134,7 +134,7 @@ static void PrintLocation(const ReportLocation *loc) {
bool print_stack = false;
Printf("%s", d.Location());
if (loc->type == ReportLocationGlobal) {
- Printf(" Location is global '%s' of size %zu at %zx (%s+%p)\n\n",
+ Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n",
loc->name, loc->size, loc->addr, loc->module, loc->offset);
} else if (loc->type == ReportLocationHeap) {
char thrbuf[kThreadBufSize];
OpenPOWER on IntegriCloud