[compiler-rt] [asan] Add test case for alignment of FakeStack frames for 4KB objects with smaller thread stack sizes (PR #152892)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 9 22:56:27 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- compiler-rt/test/asan/TestCases/fakestack_alignment2.cpp
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/test/asan/TestCases/fakestack_alignment2.cpp b/compiler-rt/test/asan/TestCases/fakestack_alignment2.cpp
index 3f0b77a5e..f1575d371 100644
--- a/compiler-rt/test/asan/TestCases/fakestack_alignment2.cpp
+++ b/compiler-rt/test/asan/TestCases/fakestack_alignment2.cpp
@@ -8,13 +8,13 @@
 #include <string.h>
 
 struct alignas(4096) page {
-    int x;
+  int x;
 };
 
-void *Thread(void *unused)  {
+void *Thread(void *unused) {
   page p1;
   uint alignment = (unsigned long)&p1 % alignof(page);
-  printf ("Thread: address modulo alignment is %u\n", alignment);
+  printf("Thread: address modulo alignment is %u\n", alignment);
   assert(alignment == 0);
 
   return NULL;
@@ -26,7 +26,7 @@ int main(int argc, char **argv) {
 
   // When the stack size is 1<<16, FakeStack's GetFrame() is out of alignment,
   // because SizeRequiredForFlags(16) == 2K.
-  pthread_attr_setstacksize(&attr, 1<<16);
+  pthread_attr_setstacksize(&attr, 1 << 16);
 
   pthread_t t;
   pthread_create(&t, &attr, Thread, 0);

``````````

</details>


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


More information about the llvm-commits mailing list