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