]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR sanitizer/59410
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 21:25:23 +0000 (21:25 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 21:25:23 +0000 (21:25 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207371 138bc75d-0d04-0410-961f-82ee72b054a4

28 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/tsan/atomic_stack.c
gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c
gcc/testsuite/c-c++-common/tsan/free_race.c
gcc/testsuite/c-c++-common/tsan/free_race2.c
gcc/testsuite/c-c++-common/tsan/mutexset1.c
gcc/testsuite/c-c++-common/tsan/race_on_barrier.c
gcc/testsuite/c-c++-common/tsan/race_on_barrier2.c
gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c
gcc/testsuite/c-c++-common/tsan/simple_race.c
gcc/testsuite/c-c++-common/tsan/simple_stack.c
gcc/testsuite/c-c++-common/tsan/sleep_sync.c
gcc/testsuite/c-c++-common/tsan/thread_leak.c
gcc/testsuite/c-c++-common/tsan/thread_leak1.c
gcc/testsuite/c-c++-common/tsan/thread_leak2.c
gcc/testsuite/c-c++-common/tsan/tiny_race.c
gcc/testsuite/c-c++-common/tsan/tls_race.c
gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c
gcc/testsuite/g++.dg/tsan/aligned_vs_unaligned_race.C
gcc/testsuite/g++.dg/tsan/atomic_free.C
gcc/testsuite/g++.dg/tsan/atomic_free2.C
gcc/testsuite/g++.dg/tsan/benign_race.C
gcc/testsuite/g++.dg/tsan/cond_race.C
gcc/testsuite/g++.dg/tsan/default_options.C
gcc/testsuite/g++.dg/tsan/fd_close_norace.C
gcc/testsuite/g++.dg/tsan/fd_close_norace2.C
gcc/testsuite/lib/tsan-dg.exp

index 014dc08fbfd21c5ea9db330ed4447a4ec24c695b..0f59583dff3105e6b56064024e60cc69ed6cf1fa 100644 (file)
@@ -1,3 +1,38 @@
+2014-01-31  Jakub Jelinek  <jakub@redhat.com>
+
+       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 <rth@redhat.com>
 
        * g++.dg/tm/pr60004.C: New.
index eac71b8793d7bf4428eab99321d230e77c25499a..6a37951201015a086354415af667b387d349fce1 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index fc76cbf5ffd1cbc31ef9ea0151015c50e8d88a70..28cd630d2c1a1ee2ad1be9db16144fb030aea8a0 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 362c92bfbeb967342d1afbfb8dbbe90b6e94095b..258f7b7420dfe0b6685839a7b070b56e3aab5b92 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <stdlib.h>
index 3c15d2d20f53641cc1f026cf3049fb451f31474a..3971180c22bda25d2bfa90836f320c32b4b7fdbf 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <stdlib.h>
index 783f262d5ed993857fb8f9a11eceb301d58cac4b..7c32a8524b44ceefd609ac868bf7ab2c038f78a4 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 407c7129272e2f0496b772da1fbe9da195cbea7b..0a0e5faba02612d633cc0d53b0a111f98e46b219 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 9576c672e1b746454cecc3e3b720f0015badba9a..b01a5cc21a27010f0ca78ede051b1683f5746c11 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index f112d097de44c10517e80bb000109393d41dae64..5dad345d85b46608d1387be267bd11699bc55c5b 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
@@ -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) .*" } */
index d8a69801ed0e4bc1f461515b703f7290ee2c6464..80a6fb6c0eba5822eda578c7ea3bc78814eada8f 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 4626efd867dcd5d291834d19829116034af0708e..a40accd40a25e826b31807ceb964ffe75b7a6a8c 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */
 /* { dg-shouldfail "tsan" } */
 
index e92d010a59b4e4f54a9d04f4235f22b1302b99bd..b66a67085ca6547fa0eb3abc30e11c4b0036c921 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
@@ -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) (.*)" } */
index 8203d54247ed86570c6fbc8973169e5a0893b300..44d44554c2ec74eb4abc5d026164c2cb424dfa87 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 416ef77600650a02d63c53a9915c84bfebfd8092..02deaba5846b9c712b7ac54f7b678b797f81c6d1 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-
 #include <pthread.h>
 #include <stdio.h>
 
index 18bcf2aa68f82430ea3e0234221bbec4d10f6650..ce28ee487e87273fe0a79f61540976af27bd3786 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index d6f4e220025bd07cd0f4afce5d5bf918c458995e..c9b8046652966549b4be0664007d24b6de031084 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 03561832d056bb85c20d8162480d243cd470fcda..962497b2821e0c99c928e8a3b57db92acf0ae21f 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 041e9af988497b2c241a514056fa3d424835a649..423867e382d1305ae46a7fb9d681fa30422e9724 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index c6a0beee23f7b9676cdb98b1134c490473881a71..898d23d50b74c8dccc7e80f1c3a227766b202731 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index ccac527e1d4826096823a4c0765e39cd1b7bf731..390be86d7164fe3e884efb5fce4b0df4b35744a5 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-do run { target { x86_64-*-linux* } } } */
-
 #include <pthread.h>
 #include <stdio.h>
 #include <stdint.h>
index afaad777de68d1b376b4115593e7645eaefa428b..26d01ae3fddc0d31d331a71d91fe30500d1ac613 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index 7ccaa1a95d9599499d39dd31202f4ca55d7247b8..1fe512cde93cea22ebaaba3fdc740fc548e7b255 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index d67b31b2805573297694953b8066ae87476d383c..b5f17208a12d39b06dfd2e548e4ea75ef0fbda5d 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
index d28912f20239e8f008f40d1b01ff356d52a97559..a9376147763b422610749df423c625e3a9bffbdf 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 /* { dg-output "ThreadSanitizer: data race.*" } */
 /* { dg-output "pthread_cond_signal.*" } */
index b688abff4a96d577d75b1efa58ac0d8b797254ac..f0c0eceeb4b3c426bd1bac01ad03aff503bb0b0b 100644 (file)
@@ -1,4 +1,3 @@
-/* { dg-do run } */
 /* { dg-shouldfail "tsan" } */
 
 #include <pthread.h>
index a31428a34567a70ff44bf6d03166f148669645c7..9babb6a8f1e0e4e9463913ef00e2df46a4b5867d 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
index f2d394c28960f265eea68e0888315a438d16a4eb..56f00f8aceed36d8e5eacc9067015df2f0a7d2ab 100644 (file)
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
index 2274f066dffaafb310369525c22ce140d11b9611..89696a9c00fca4847939a7d52f23c007c0d47fbd 100644 (file)
@@ -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
+    }
 }