gimplify.c (gimplify_function_tree): Check the no_sanitize_thread decl attribute.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 21 Jan 2015 18:08:42 +0000 (18:08 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Wed, 21 Jan 2015 18:08:42 +0000 (18:08 +0000)
gcc/ChangeLog:
2015-01-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * gimplify.c (gimplify_function_tree): Check the no_sanitize_thread
        decl attribute.

gcc/testsuite/ChangeLog
2015-01-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * gcc/testsuite/c-c++-common/tsan/step.c: New testcase.

From-SVN: r219961

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/tsan/step.c [new file with mode: 0644]

index a08d231b72d301930cd27ed9b0e225e20b7cfb55..1c0a45e5e7ffe3be07f996045d418fe267392cee 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * gimplify.c (gimplify_function_tree): Check the no_sanitize_thread
+       decl attribute.
+
 2015-01-21  David Sherwood  <david.sherwood@arm.com>
            Tejas Belagod <Tejas.Belagod@arm.com>
 
index 947b0af8d566c8b0b29356096d7c07029720453c..1353ada2f857970470f6adbd36fcdc26c45867af 100644 (file)
@@ -9258,7 +9258,8 @@ gimplify_function_tree (tree fndecl)
       bind = new_bind;
     }
 
-  if (flag_sanitize & SANITIZE_THREAD)
+  if ((flag_sanitize & SANITIZE_THREAD) != 0
+      && !lookup_attribute ("no_sanitize_thread", DECL_ATTRIBUTES (fndecl)))
     {
       gcall *call = gimple_build_call_internal (IFN_TSAN_FUNC_EXIT, 0);
       gimple tf = gimple_build_try (seq, call, GIMPLE_TRY_FINALLY);
index f679c04144d24de4bdc64395ef4c4a9115cc9b47..e1a4ce87cfcca1d8cbf6c24e3d4b32a659f0129c 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-21  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       * gcc/testsuite/c-c++-common/tsan/step.c: New testcase.
+
 2015-01-21  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/aarch64/advsimd-intrinsics/vqdmull_n.c: New file.
diff --git a/gcc/testsuite/c-c++-common/tsan/step.c b/gcc/testsuite/c-c++-common/tsan/step.c
new file mode 100644 (file)
index 0000000..ce9edd4
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+extern int sched_yield (void);
+static volatile int serial = 0;
+
+__attribute__((no_sanitize_thread))
+void step (int i)
+{
+   while (__atomic_load_n (&serial, __ATOMIC_ACQUIRE) != i - 1)
+     sched_yield ();
+   __atomic_store_n (&serial, i, __ATOMIC_RELEASE);
+}
+
+/* { dg-final { scan-assembler-not "__tsan_func_entry" } } */
+/* { dg-final { scan-assembler-not "__tsan_func_exit" } } */