diff options
-rw-r--r-- | lib/tsan/rtl/tsan_report.cc | 11 | ||||
-rw-r--r-- | test/tsan/global_race.cc | 2 | ||||
-rw-r--r-- | test/tsan/global_race2.cc | 2 | ||||
-rw-r--r-- | test/tsan/global_race3.cc | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/lib/tsan/rtl/tsan_report.cc b/lib/tsan/rtl/tsan_report.cc index f54f04b73..c56abce1d 100644 --- a/lib/tsan/rtl/tsan_report.cc +++ b/lib/tsan/rtl/tsan_report.cc @@ -171,9 +171,14 @@ static void PrintLocation(const ReportLocation *loc) { Printf("%s", d.Location()); if (loc->type == ReportLocationGlobal) { const DataInfo &global = loc->global; - Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n", - global.name, global.size, global.start, - StripModuleName(global.module), global.module_offset); + if (global.size != 0) + Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n", + global.name, global.size, global.start, + StripModuleName(global.module), global.module_offset); + else + Printf(" Location is global '%s' at %p (%s+%p)\n\n", global.name, + global.start, StripModuleName(global.module), + global.module_offset); } else if (loc->type == ReportLocationHeap) { char thrbuf[kThreadBufSize]; Printf(" Location is heap block of size %zu at %p allocated by %s:\n", diff --git a/test/tsan/global_race.cc b/test/tsan/global_race.cc index 3128ec411..d1f0e3859 100644 --- a/test/tsan/global_race.cc +++ b/test/tsan/global_race.cc @@ -23,5 +23,5 @@ int main() { // CHECK: addr=[[ADDR:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] (global_race.cc.exe+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'GlobalData' {{(of size 40 )?}}at [[ADDR]] (global_race.cc.exe+0x{{[0-9,a-f]+}}) diff --git a/test/tsan/global_race2.cc b/test/tsan/global_race2.cc index 4ab2842e7..5c29a78c7 100644 --- a/test/tsan/global_race2.cc +++ b/test/tsan/global_race2.cc @@ -23,5 +23,5 @@ int main() { // CHECK: addr2=[[ADDR2:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'x' of size 4 at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'x' {{(of size 4 )?}}at [[ADDR2]] ({{.*}}+0x{{[0-9,a-f]+}}) diff --git a/test/tsan/global_race3.cc b/test/tsan/global_race3.cc index 1531d7830..6361c4339 100644 --- a/test/tsan/global_race3.cc +++ b/test/tsan/global_race3.cc @@ -28,4 +28,4 @@ int main() { // CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]] // CHECK: WARNING: ThreadSanitizer: data race -// CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) +// CHECK: Location is global 'XXX::YYY::ZZZ' {{(of size 40 )?}}at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) |