diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 014dc08fbfd2..0f59583dff31 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,38 @@ +2014-01-31 Jakub Jelinek + + PR sanitizer/59410 + * lib/tsan-dg.exp (tsan_init): Instead of not running any + tsan tests if trivial testcase doesn't run, set dg-do-what-default + to compile. + (tsan_finish): Restore dg-do-what-default. + * g++.dg/tsan/atomic_free.C: Remove dg-do line. + * g++.dg/tsan/fd_close_norace2.C: Likewise. + * g++.dg/tsan/default_options.C: Likewise. + * g++.dg/tsan/aligned_vs_unaligned_race.C: Likewise. + * g++.dg/tsan/atomic_free2.C: Likewise. + * g++.dg/tsan/cond_race.C: Likewise. + * g++.dg/tsan/fd_close_norace.C: Likewise. + * g++.dg/tsan/benign_race.C: Likewise. + * c-c++-common/tsan/fd_pipe_race.c: Likewise. + * c-c++-common/tsan/simple_race.c: Likewise. + * c-c++-common/tsan/mutexset1.c: Likewise. + * c-c++-common/tsan/thread_leak2.c: Likewise. + * c-c++-common/tsan/tls_race.c: Likewise. + * c-c++-common/tsan/write_in_reader_lock.c: Likewise. + * c-c++-common/tsan/race_on_barrier2.c: Likewise. + * c-c++-common/tsan/free_race2.c: Likewise. + * c-c++-common/tsan/thread_leak.c: Likewise. + * c-c++-common/tsan/thread_leak1.c: Likewise. + * c-c++-common/tsan/race_on_barrier.c: Likewise. + * c-c++-common/tsan/free_race.c: Likewise. + * c-c++-common/tsan/sleep_sync.c: Likewise. + * c-c++-common/tsan/tiny_race.c: Likewise. + * c-c++-common/tsan/race_on_mutex2.c: Likewise. + * c-c++-common/tsan/atomic_stack.c: Likewise. + * c-c++-common/tsan/race_on_mutex.c: Likewise. Adjust line numbers + in dg-output regexps. + * c-c++-common/tsan/simple_stack.c: Likewise. + 2014-01-31 Richard Henderson * g++.dg/tm/pr60004.C: New. diff --git a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c index eac71b8793d7..6a3795120101 100644 --- a/gcc/testsuite/c-c++-common/tsan/atomic_stack.c +++ b/gcc/testsuite/c-c++-common/tsan/atomic_stack.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c b/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c index fc76cbf5ffd1..28cd630d2c1a 100644 --- a/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c +++ b/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/free_race.c b/gcc/testsuite/c-c++-common/tsan/free_race.c index 362c92bfbeb9..258f7b7420df 100644 --- a/gcc/testsuite/c-c++-common/tsan/free_race.c +++ b/gcc/testsuite/c-c++-common/tsan/free_race.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/free_race2.c b/gcc/testsuite/c-c++-common/tsan/free_race2.c index 3c15d2d20f53..3971180c22bd 100644 --- a/gcc/testsuite/c-c++-common/tsan/free_race2.c +++ b/gcc/testsuite/c-c++-common/tsan/free_race2.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/mutexset1.c b/gcc/testsuite/c-c++-common/tsan/mutexset1.c index 783f262d5ed9..7c32a8524b44 100644 --- a/gcc/testsuite/c-c++-common/tsan/mutexset1.c +++ b/gcc/testsuite/c-c++-common/tsan/mutexset1.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c b/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c index 407c7129272e..0a0e5faba026 100644 --- a/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c +++ b/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c b/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c index 9576c672e1b7..b01a5cc21a27 100644 --- a/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c +++ b/gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include 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 f112d097de44..5dad345d85b4 100644 --- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c +++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include @@ -38,7 +37,7 @@ int main() { /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */ /* { 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 " #1 Thread2.* .*(race_on_mutex.c:21|\\?{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:13|\\?{2}:0) .*" } */ +/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */ diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c b/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c index d8a69801ed0e..80a6fb6c0eba 100644 --- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c +++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/simple_race.c b/gcc/testsuite/c-c++-common/tsan/simple_race.c index 4626efd867dc..a40accd40a25 100644 --- a/gcc/testsuite/c-c++-common/tsan/simple_race.c +++ b/gcc/testsuite/c-c++-common/tsan/simple_race.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */ /* { dg-shouldfail "tsan" } */ diff --git a/gcc/testsuite/c-c++-common/tsan/simple_stack.c b/gcc/testsuite/c-c++-common/tsan/simple_stack.c index e92d010a59b4..b66a67085ca6 100644 --- a/gcc/testsuite/c-c++-common/tsan/simple_stack.c +++ b/gcc/testsuite/c-c++-common/tsan/simple_stack.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include @@ -51,16 +50,16 @@ int main() { /* { dg-output "WARNING: ThreadSanitizer: data race.*" } */ /* { dg-output " Write of size 4 at .* by thread T1:(\n|\r\n|\r)" } */ -/* { dg-output " #0 foo1.* .*(simple_stack.c:11|\\?{2}:0) (.*)" } */ -/* { dg-output " #1 bar1.* .*(simple_stack.c:16|\\?{2}:0) (.*)" } */ -/* { dg-output " #2 Thread1.* .*(simple_stack.c:30|\\?{2}:0) (.*)" } */ +/* { dg-output " #0 foo1.* .*(simple_stack.c:10|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 bar1.* .*(simple_stack.c:15|\\?{2}:0) (.*)" } */ +/* { dg-output " #2 Thread1.* .*(simple_stack.c:29|\\?{2}:0) (.*)" } */ /* { dg-output " Previous read of size 4 at .* by thread T2:(\n|\r\n|\r)" } */ -/* { dg-output " #0 foo2.* .*(simple_stack.c:20|\\?{2}:0) (.*)" } */ -/* { dg-output " #1 bar2.* .*(simple_stack.c:25|\\?{2}:0) (.*)" } */ -/* { dg-output " #2 Thread2.* .*(simple_stack.c:35|\\?{2}:0) (.*)" } */ +/* { dg-output " #0 foo2.* .*(simple_stack.c:19|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 bar2.* .*(simple_stack.c:24|\\?{2}:0) (.*)" } */ +/* { dg-output " #2 Thread2.* .*(simple_stack.c:34|\\?{2}:0) (.*)" } */ /* { dg-output " Thread T1 \\(tid=.*, running\\) created by main thread at:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_create .* (.*)" } */ -/* { dg-output " #1 StartThread.* .*(simple_stack.c:40|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */ /* { dg-output " Thread T2 (.*) created by main thread at:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_create .* (.*)" } */ -/* { dg-output " #1 StartThread.* .*(simple_stack.c:40|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */ diff --git a/gcc/testsuite/c-c++-common/tsan/sleep_sync.c b/gcc/testsuite/c-c++-common/tsan/sleep_sync.c index 8203d54247ed..44d44554c2ec 100644 --- a/gcc/testsuite/c-c++-common/tsan/sleep_sync.c +++ b/gcc/testsuite/c-c++-common/tsan/sleep_sync.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/thread_leak.c b/gcc/testsuite/c-c++-common/tsan/thread_leak.c index 416ef7760065..02deaba5846b 100644 --- a/gcc/testsuite/c-c++-common/tsan/thread_leak.c +++ b/gcc/testsuite/c-c++-common/tsan/thread_leak.c @@ -1,5 +1,3 @@ -/* { dg-do run } */ - #include #include diff --git a/gcc/testsuite/c-c++-common/tsan/thread_leak1.c b/gcc/testsuite/c-c++-common/tsan/thread_leak1.c index 18bcf2aa68f8..ce28ee487e87 100644 --- a/gcc/testsuite/c-c++-common/tsan/thread_leak1.c +++ b/gcc/testsuite/c-c++-common/tsan/thread_leak1.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/thread_leak2.c b/gcc/testsuite/c-c++-common/tsan/thread_leak2.c index d6f4e220025b..c9b804665296 100644 --- a/gcc/testsuite/c-c++-common/tsan/thread_leak2.c +++ b/gcc/testsuite/c-c++-common/tsan/thread_leak2.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/tiny_race.c b/gcc/testsuite/c-c++-common/tsan/tiny_race.c index 03561832d056..962497b2821e 100644 --- a/gcc/testsuite/c-c++-common/tsan/tiny_race.c +++ b/gcc/testsuite/c-c++-common/tsan/tiny_race.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/tls_race.c b/gcc/testsuite/c-c++-common/tsan/tls_race.c index 041e9af98849..423867e382d1 100644 --- a/gcc/testsuite/c-c++-common/tsan/tls_race.c +++ b/gcc/testsuite/c-c++-common/tsan/tls_race.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c b/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c index c6a0beee23f7..898d23d50b74 100644 --- a/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c +++ b/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/g++.dg/tsan/aligned_vs_unaligned_race.C b/gcc/testsuite/g++.dg/tsan/aligned_vs_unaligned_race.C index ccac527e1d48..390be86d7164 100644 --- a/gcc/testsuite/g++.dg/tsan/aligned_vs_unaligned_race.C +++ b/gcc/testsuite/g++.dg/tsan/aligned_vs_unaligned_race.C @@ -1,5 +1,3 @@ -/* { dg-do run { target { x86_64-*-linux* } } } */ - #include #include #include diff --git a/gcc/testsuite/g++.dg/tsan/atomic_free.C b/gcc/testsuite/g++.dg/tsan/atomic_free.C index afaad777de68..26d01ae3fddc 100644 --- a/gcc/testsuite/g++.dg/tsan/atomic_free.C +++ b/gcc/testsuite/g++.dg/tsan/atomic_free.C @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/g++.dg/tsan/atomic_free2.C b/gcc/testsuite/g++.dg/tsan/atomic_free2.C index 7ccaa1a95d95..1fe512cde93c 100644 --- a/gcc/testsuite/g++.dg/tsan/atomic_free2.C +++ b/gcc/testsuite/g++.dg/tsan/atomic_free2.C @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/g++.dg/tsan/benign_race.C b/gcc/testsuite/g++.dg/tsan/benign_race.C index d67b31b28055..b5f17208a12d 100644 --- a/gcc/testsuite/g++.dg/tsan/benign_race.C +++ b/gcc/testsuite/g++.dg/tsan/benign_race.C @@ -1,5 +1,3 @@ -/* { dg-do run } */ - #include #include #include diff --git a/gcc/testsuite/g++.dg/tsan/cond_race.C b/gcc/testsuite/g++.dg/tsan/cond_race.C index d28912f20239..a9376147763b 100644 --- a/gcc/testsuite/g++.dg/tsan/cond_race.C +++ b/gcc/testsuite/g++.dg/tsan/cond_race.C @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ /* { dg-output "ThreadSanitizer: data race.*" } */ /* { dg-output "pthread_cond_signal.*" } */ diff --git a/gcc/testsuite/g++.dg/tsan/default_options.C b/gcc/testsuite/g++.dg/tsan/default_options.C index b688abff4a96..f0c0eceeb4b3 100644 --- a/gcc/testsuite/g++.dg/tsan/default_options.C +++ b/gcc/testsuite/g++.dg/tsan/default_options.C @@ -1,4 +1,3 @@ -/* { dg-do run } */ /* { dg-shouldfail "tsan" } */ #include diff --git a/gcc/testsuite/g++.dg/tsan/fd_close_norace.C b/gcc/testsuite/g++.dg/tsan/fd_close_norace.C index a31428a34567..9babb6a8f1e0 100644 --- a/gcc/testsuite/g++.dg/tsan/fd_close_norace.C +++ b/gcc/testsuite/g++.dg/tsan/fd_close_norace.C @@ -1,5 +1,3 @@ -/* { dg-do run } */ - #include #include #include diff --git a/gcc/testsuite/g++.dg/tsan/fd_close_norace2.C b/gcc/testsuite/g++.dg/tsan/fd_close_norace2.C index f2d394c28960..56f00f8aceed 100644 --- a/gcc/testsuite/g++.dg/tsan/fd_close_norace2.C +++ b/gcc/testsuite/g++.dg/tsan/fd_close_norace2.C @@ -1,5 +1,3 @@ -/* { dg-do run } */ - #include #include #include diff --git a/gcc/testsuite/lib/tsan-dg.exp b/gcc/testsuite/lib/tsan-dg.exp index 2274f066dffa..89696a9c00fc 100644 --- a/gcc/testsuite/lib/tsan-dg.exp +++ b/gcc/testsuite/lib/tsan-dg.exp @@ -69,6 +69,8 @@ proc tsan_init { args } { global ALWAYS_CXXFLAGS global TOOL_OPTIONS global tsan_saved_TEST_ALWAYS_FLAGS + global dg-do-what-default + global tsan_saved_dg-do-what-default set link_flags "" if ![is_remote host] { @@ -79,6 +81,9 @@ proc tsan_init { args } { } } + if [info exists dg-do-what-default] { + set tsan_saved_dg-do-what-default ${dg-do-what-default} + } if [info exists TEST_ALWAYS_FLAGS] { set tsan_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS } @@ -96,8 +101,11 @@ proc tsan_init { args } { if [check_runtime_nocache tsan_works { int main () { return 0; } } "-fPIE -pie -fsanitize=thread -g"] { - return 1 + set dg-do-what-default run + } else { + set dg-do-what-default compile } + return 1 } return 0 } @@ -109,10 +117,17 @@ proc tsan_init { args } { proc tsan_finish { args } { global TEST_ALWAYS_FLAGS global tsan_saved_TEST_ALWAYS_FLAGS + global dg-do-what-default + global tsan_saved_dg-do-what-default if [info exists tsan_saved_TEST_ALWAYS_FLAGS] { set TEST_ALWAYS_FLAGS $tsan_saved_TEST_ALWAYS_FLAGS } else { unset TEST_ALWAYS_FLAGS } + if [info exists tsan_saved_dg-do-what-default] { + set dg-do-what-default ${tsan_saved_dg-do-what-default} + } else { + unset dg-do-what-default + } }