[compiler-rt] [tsan][go] use __builtin_memcpy for 128-bit Go atomic args buffer access (PR #213123)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 05:47:48 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions c,cpp -- compiler-rt/lib/tsan/go/test.c compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c
index dfefe5f5c..2f4869076 100644
--- a/compiler-rt/lib/tsan/go/test.c
+++ b/compiler-rt/lib/tsan/go/test.c
@@ -35,9 +35,10 @@ void __tsan_release(void *thr, void *addr);
 void __tsan_release_acquire(void *thr, void *addr);
 void __tsan_release_merge(void *thr, void *addr);
 #if defined(__SIZEOF_INT128__)
-void __tsan_go_atomic128_load(void *thr, void *cpc, void *pc, char *a);
-void __tsan_go_atomic128_store(void *thr, void *cpc, void *pc, char *a);
-void __tsan_go_atomic128_compare_exchange(void *thr, void *cpc, void *pc, char *a);
+void __tsan_go_atomic128_load(void* thr, void* cpc, void* pc, char* a);
+void __tsan_go_atomic128_store(void* thr, void* cpc, void* pc, char* a);
+void __tsan_go_atomic128_compare_exchange(void* thr, void* cpc, void* pc,
+                                          char* a);
 #endif
 
 void *current_proc;
@@ -120,15 +121,17 @@ int main(void) {
   current_proc = proc0;
 #if defined(__SIZEOF_INT128__)
   {
-    // Align `a` to 16 bytes so `a + 8` and `a + 24` are 8-byte aligned (8 mod 16).
+    // Align `a` to 16 bytes so `a + 8` and `a + 24` are 8-byte aligned (8 mod
+    // 16).
     __attribute__((aligned(16))) char a[64];
-    *(void **)(a + 0) = buf;
+    *(void**)(a + 0) = buf;
     __builtin_memset(a + 8, 0x11, 16);
-    __tsan_go_atomic128_store(thr0, (char *)&barfoo + 1, (char *)&barfoo + 1, a);
+    __tsan_go_atomic128_store(thr0, (char*)&barfoo + 1, (char*)&barfoo + 1, a);
     __builtin_memset(a + 8, 0, 16);
-    __tsan_go_atomic128_load(thr0, (char *)&barfoo + 1, (char *)&barfoo + 1, a);
+    __tsan_go_atomic128_load(thr0, (char*)&barfoo + 1, (char*)&barfoo + 1, a);
     __builtin_memset(a + 24, 0x22, 16);
-    __tsan_go_atomic128_compare_exchange(thr0, (char *)&barfoo + 1, (char *)&barfoo + 1, a);
+    __tsan_go_atomic128_compare_exchange(thr0, (char*)&barfoo + 1,
+                                         (char*)&barfoo + 1, a);
   }
 #endif
   __tsan_fini();

``````````

</details>


https://github.com/llvm/llvm-project/pull/213123


More information about the llvm-commits mailing list