[libc] [llvm] [libc] Improve qsort (PR #120450)

LLVM Continuous Integration via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 29 11:58:30 PST 2024


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-gcc-fullbuild-dbg` running on `libc-x86_64-debian-fullbuild` while building `libc,utils` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/13071

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN      ] LlvmLibcStrtouint32Test.DecodeInOtherBases
[       OK ] LlvmLibcStrtouint32Test.DecodeInOtherBases (515 ms)
[ RUN      ] LlvmLibcStrtouint32Test.CleanBaseSixteenDecode
[       OK ] LlvmLibcStrtouint32Test.CleanBaseSixteenDecode (75 us)
[ RUN      ] LlvmLibcStrtouint32Test.MessyBaseSixteenDecode
[       OK ] LlvmLibcStrtouint32Test.MessyBaseSixteenDecode (3 us)
[ RUN      ] LlvmLibcStrtouint32Test.AutomaticBaseSelection
[       OK ] LlvmLibcStrtouint32Test.AutomaticBaseSelection (5 us)
Ran 14 tests.  PASS: 14  FAIL: 0
[1107/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o
FAILED: libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o -MF libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o.d -o libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/quick_sort_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/quick_sort_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h: In lambda function:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:310:34: error: ‘ARRAY_INITIAL_VALS’ is not captured
  310 |         const uint8_t elem_val = ARRAY_INITIAL_VALS[elem_i];
      |                                  ^~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:304:32: note: the lambda has no capture-default
  304 |     const auto fill_buf = [&buf](size_t elem_size) {
      |                                ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:289:23: note: ‘constexpr const uint8_t ARRAY_INITIAL_VALS [50]’ declared here
  289 |     constexpr uint8_t ARRAY_INITIAL_VALS[] = {
      |                       ^~~~~~~~~~~~~~~~~~
[1108/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o
FAILED: libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o -MF libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o.d -o libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/heap_sort_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/heap_sort_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h: In lambda function:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:310:34: error: ‘ARRAY_INITIAL_VALS’ is not captured
  310 |         const uint8_t elem_val = ARRAY_INITIAL_VALS[elem_i];
      |                                  ^~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:304:32: note: the lambda has no capture-default
  304 |     const auto fill_buf = [&buf](size_t elem_size) {
      |                                ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:289:23: note: ‘constexpr const uint8_t ARRAY_INITIAL_VALS [50]’ declared here
  289 |     constexpr uint8_t ARRAY_INITIAL_VALS[] = {
      |                       ^~~~~~~~~~~~~~~~~~
[1109/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.qsort_r_test.__unit__.__build__.dir/qsort_r_test.cpp.o
[1110/1116] Running unit test libc.test.src.time.nanosleep_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcNanosleep.SmokeTest
[       OK ] LlvmLibcNanosleep.SmokeTest (134 us)
Ran 1 tests.  PASS: 1  FAIL: 0
ninja: build stopped: subcommand failed.
['ninja', 'libc-unit-tests'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 164, in step
    yield
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN      ] LlvmLibcStrtouint32Test.DecodeInOtherBases
[       OK ] LlvmLibcStrtouint32Test.DecodeInOtherBases (515 ms)
[ RUN      ] LlvmLibcStrtouint32Test.CleanBaseSixteenDecode
[       OK ] LlvmLibcStrtouint32Test.CleanBaseSixteenDecode (75 us)
[ RUN      ] LlvmLibcStrtouint32Test.MessyBaseSixteenDecode
[       OK ] LlvmLibcStrtouint32Test.MessyBaseSixteenDecode (3 us)
[ RUN      ] LlvmLibcStrtouint32Test.AutomaticBaseSelection
[       OK ] LlvmLibcStrtouint32Test.AutomaticBaseSelection (5 us)
Ran 14 tests.  PASS: 14  FAIL: 0
[1107/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o
FAILED: libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o -MF libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o.d -o libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.quick_sort_test.__unit__.__build__.dir/quick_sort_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/quick_sort_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/quick_sort_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h: In lambda function:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:310:34: error: ‘ARRAY_INITIAL_VALS’ is not captured
  310 |         const uint8_t elem_val = ARRAY_INITIAL_VALS[elem_i];
      |                                  ^~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:304:32: note: the lambda has no capture-default
  304 |     const auto fill_buf = [&buf](size_t elem_size) {
      |                                ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:289:23: note: ‘constexpr const uint8_t ARRAY_INITIAL_VALS [50]’ declared here
  289 |     constexpr uint8_t ARRAY_INITIAL_VALS[] = {
      |                       ^~~~~~~~~~~~~~~~~~
[1108/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o
FAILED: libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=gnu++17 -MD -MT libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o -MF libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o.d -o libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.heap_sort_test.__unit__.__build__.dir/heap_sort_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/heap_sort_test.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/heap_sort_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h: In lambda function:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:310:34: error: ‘ARRAY_INITIAL_VALS’ is not captured
  310 |         const uint8_t elem_val = ARRAY_INITIAL_VALS[elem_i];
      |                                  ^~~~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:304:32: note: the lambda has no capture-default
  304 |     const auto fill_buf = [&buf](size_t elem_size) {
      |                                ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/SortingTest.h:289:23: note: ‘constexpr const uint8_t ARRAY_INITIAL_VALS [50]’ declared here
  289 |     constexpr uint8_t ARRAY_INITIAL_VALS[] = {
      |                       ^~~~~~~~~~~~~~~~~~
[1109/1116] Building CXX object libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.qsort_r_test.__unit__.__build__.dir/qsort_r_test.cpp.o
[1110/1116] Running unit test libc.test.src.time.nanosleep_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcNanosleep.SmokeTest
[       OK ] LlvmLibcNanosleep.SmokeTest (134 us)
Ran 1 tests.  PASS: 1  FAIL: 0
ninja: build stopped: subcommand failed.
['ninja', 'libc-unit-tests'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 164, in step
    yield

```

</details>

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


More information about the llvm-commits mailing list