Hi.

Test-case mentioned in the PR looks as follows on ppc64le:

WARNING: ThreadSanitizer: data race (pid=45910)
  Atomic read of size 1 at 0x000010020200 by thread T2:
    #0 pthread_mutex_lock 
../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3608
 (libtsan.so.0+0x000000044724)

    #1 Thread2(void*) 
/home/marxin/Programming/gcc/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c:22 
(race_on_mutex.exe+0x000010001110)

  Previous write of size 8 at 0x000010020200 by thread T1:
    #0 memset 
../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:558 
(libtsan.so.0+0x000000036194)
    #1 __pthread_mutex_init <null> (libpthread.so.0+0x00000000adcc)
    #2 Thread1(void*) 
/home/marxin/Programming/gcc/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c:12 
(race_on_mutex.exe+0x000010000fe4)

compared to what's on x86_64-linux-gnu:

WARNING: ThreadSanitizer: data race (pid=8917)
  Atomic read of size 1 at 0x000000602100 by thread T2:
    #0 pthread_mutex_lock 
../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3608
 (libtsan.so.0+0x00000003bc1f)
    #1 Thread2(void*) 
/home/marxin/Programming/gcc2/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c:22
 (race_on_mutex.exe+0x000000400f1c)

  Previous write of size 1 at 0x000000602100 by thread T1:
    #0 pthread_mutex_init 
../../../../libsanitizer/tsan/tsan_interceptors.cc:1117 
(libtsan.so.0+0x00000002bf5e)
    #1 Thread1(void*) 
/home/marxin/Programming/gcc2/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c:12
 (race_on_mutex.exe+0x000000400e99)

Bill suggested to disable memset builtin expansion, but it won't help as the 
back-trace leads to libpthread.so.
Thus I'm make the scan more verbose.

Tested on both x86_64-linux-gnu and ppc64le-linux-gnu.

Ready for trunk?
Thanks,
Martin
>From 2a9a475169bc95f147d67df343458fc0f7069512 Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Mon, 24 Apr 2017 14:59:18 +0200
Subject: [PATCH] Fix test-case on ppc64le (PR testsuite/79455).

gcc/testsuite/ChangeLog:

2017-04-24  Martin Liska  <mli...@suse.cz>

	* c-c++-common/tsan/race_on_mutex.c: Make the scanned pattern
	more generic.
---
 gcc/testsuite/c-c++-common/tsan/race_on_mutex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
index ae30d053c92..80c193789d7 100644
--- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
+++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
@@ -40,6 +40,6 @@ int main() {
 /* { dg-output "  Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */
 /* { dg-output "    #0 pthread_mutex_lock.*" } */
 /* { dg-output "    #1 Thread2.* .*(race_on_mutex.c:22|\\?{2}:0) (.*)" } */
-/* { dg-output "  Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */
-/* { dg-output "    #0 pthread_mutex_init .* (.)*" } */
-/* { dg-output "    #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
+/* { dg-output "  Previous write of size . at .* by thread T1:(\n|\r\n|\r)" } */
+/* { dg-output "    #. .*pthread_mutex_init .* (.)*" } */
+/* { dg-output "    #. Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
-- 
2.12.2

Reply via email to