[libc-commits] [libc] 7cb6e6b - [libc] Fix sort test failing on NVPTX

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Jan 6 07:04:37 PST 2025


Author: Joseph Huber
Date: 2025-01-06T09:04:31-06:00
New Revision: 7cb6e6bced8ca5767c3e609f4826982638fd9543

URL: https://github.com/llvm/llvm-project/commit/7cb6e6bced8ca5767c3e609f4826982638fd9543
DIFF: https://github.com/llvm/llvm-project/commit/7cb6e6bced8ca5767c3e609f4826982638fd9543.diff

LOG: [libc] Fix sort test failing on NVPTX

Summary:
This test uses too much stack and crashes, make the buffer `static` to
push it to `.bss`. This shouldn't change behavior because the tests are
all run single threaded.

Added: 
    

Modified: 
    libc/test/src/stdlib/SortingTest.h

Removed: 
    


################################################################################
diff  --git a/libc/test/src/stdlib/SortingTest.h b/libc/test/src/stdlib/SortingTest.h
index 611206ed708d25..681a420ea72744 100644
--- a/libc/test/src/stdlib/SortingTest.h
+++ b/libc/test/src/stdlib/SortingTest.h
@@ -298,8 +298,9 @@ class SortingTest : public LIBC_NAMESPACE::testing::Test {
     static_assert(ARRAY_LEN < 256); // so we can encode the values.
 
     // Minimum alignment to test implementation for bugs related to assuming
-    // incorrect association between alignment and element size.
-    alignas(1) uint8_t buf[BUF_SIZE];
+    // incorrect association between alignment and element size. The buffer is
+    // 'static' as otherwise it will exhaust the stack on the GPU targets.
+    alignas(1) static uint8_t buf[BUF_SIZE];
 
     // GCC still requires capturing the constant ARRAY_INITIAL_VALS in the
     // lambda hence, let's use & to implicitly capture all needed variables


        


More information about the libc-commits mailing list