Skip to content

Commit

Permalink
[libc] Fix sort test failing on NVPTX
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhuber6 committed Jan 6, 2025
1 parent 05bd7d2 commit 7cb6e6b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libc/test/src/stdlib/SortingTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7cb6e6b

Please sign in to comment.