function2
function2 copied to clipboard
Test size_match_layout in regressions.cpp fails on i586/i686
@Naios
Commit Hash
2d3a878ef19dd5d2fb188898513610fac0a48621
Expected Behavior
make -k test should be successful
Actual Behavior
The test size_match_layout fails on i586/i686:
[ RUN ] regression_tests.size_match_layout
/tmp/function2/test/regressions.cpp:62: Failure
Expected equality of these values:
sizeof(fn)
Which is: 48
fu2::detail::object_size::value
Which is: 32
[ FAILED ] regression_tests.size_match_layout (0 ms)
Steps to Reproduce
I cloned the repo (commit - 2d3a878ef19dd5d2fb188898513610fac0a48621) and was building on Slackware 15.0 (32bit)
$ mkdir build && (cd build && cmake .. && make && make -k test)
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/function2/build
[ 5%] Building CXX object test/CMakeFiles/function2_playground.dir/playground.cpp.o
[ 11%] Linking CXX executable function2_playground
[ 11%] Built target function2_playground
[ 16%] Building CXX object test/CMakeFiles/gtest.dir/googletest/googletest/src/gtest-all.cc.o
In file included from /tmp/function2/test/googletest/googletest/src/gtest-all.cc:43:
/tmp/function2/test/googletest/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/tmp/function2/test/googletest/googletest/src/gtest-death-test.cc:1012:24: warning: ‘dummy’ may be used uninitialized [-Wmaybe-uninitialized]
1012 | StackLowerThanAddress(&dummy, &result);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/tmp/function2/test/googletest/googletest/src/gtest-death-test.cc:1002:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
1002 | static void StackLowerThanAddress(const void* ptr, bool* result) {
| ^~~~~~~~~~~~~~~~~~~~~
/tmp/function2/test/googletest/googletest/src/gtest-death-test.cc:1010:7: note: ‘dummy’ declared here
1010 | int dummy;
| ^~~~~
[ 22%] Building CXX object test/CMakeFiles/gtest.dir/googletest/googletest/src/gtest_main.cc.o
[ 27%] Linking CXX static library libgtest.a
[ 27%] Built target gtest
[ 33%] Building CXX object test/CMakeFiles/function2_tests.dir/assign-and-constructible-test.cpp.o
[ 38%] Building CXX object test/CMakeFiles/function2_tests.dir/build-test.cpp.o
[ 44%] Building CXX object test/CMakeFiles/function2_tests.dir/empty-function-call-test.cpp.o
[ 50%] Building CXX object test/CMakeFiles/function2_tests.dir/functionality-test.cpp.o
[ 55%] Building CXX object test/CMakeFiles/function2_tests.dir/noexcept-test.cpp.o
[ 61%] Building CXX object test/CMakeFiles/function2_tests.dir/self-containing-test.cpp.o
[ 66%] Building CXX object test/CMakeFiles/function2_tests.dir/standard-compliant-test.cpp.o
[ 72%] Building CXX object test/CMakeFiles/function2_tests.dir/type-test.cpp.o
[ 77%] Building CXX object test/CMakeFiles/function2_tests.dir/multi-signature-test.cpp.o
[ 83%] Building CXX object test/CMakeFiles/function2_tests.dir/regressions.cpp.o
/tmp/function2/test/regressions.cpp: In function ‘fu2::unique_function<void()> issue_14_create()’:
/tmp/function2/test/regressions.cpp:137:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
137 | return std::move(func);
| ~~~~~~~~~^~~~~~
/tmp/function2/test/regressions.cpp:137:19: note: remove ‘std::move’ call
[ 88%] Building CXX object test/CMakeFiles/function2_tests.dir/view-test.cpp.o
[ 94%] Building CXX object test/CMakeFiles/function2_tests.dir/overload-test.cpp.o
[100%] Linking CXX executable function2_tests
[100%] Built target function2_tests
Running tests...
Test project /tmp/function2/build
Start 1: function2-unit-tests
1/1 Test #1: function2-unit-tests .............***Failed 0.01 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.01 sec
The following tests FAILED:
1 - function2-unit-tests (Failed)
Errors while running CTest
Output from these tests are in: /tmp/function2/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
make: *** [Makefile:112: test] Error 8
Your Environment
- OS: Slackware 15.0 (i586)
- Compiler and version: GCC 11.2.0
- Standard library (if non default): glibc-2.33
I also tried this in a debian docker container (docker run --rm -it --platform linux/386 debian:10 ...) and it failed the same test, so do not think this is Slackware related.
I also checked this on alpine 32bit, and the test does pass there - though this is with musl - docker run --rm -it --platform linux/386 alpine:3.16 ...
The test also passes on Slackwarearm-15.0, which is 32bit armv7.
Have you tested this issue again with a latest GCC?
Thanks for your reply.
I just checked with debian bookworm which ships with GCC 12.2.0 it also fails:
container="$(docker run --rm -d --platform linux/386 debian:bookwork@sha256:3d868b5eb908155f3784317b3dda2941df87bbbbaa4608f84881de66d9bb297b tail -f /dev/null)"
docker exec -it -e DEBIAN_FRONTEND=noninteractive -w / "$container" sh -c 'apt update && apt install -y git build-essential cmake'
docker exec -it -w / "$container" sh -c 'git clone https://github.com/Naios/function2.git'
docker exec -it -w /function2 "$container" sh -c 'git submodule update --init'
docker exec -it -w /function2 "$container" sh -c 'gcc --version'
docker exec -it -w /function2 "$container" sh -c 'mkdir build && (cd build && cmake .. && make && make -k test)' || true
docker exec -it -w /function2 "$container" sh -c 'sed -n "/regression_tests.size_match_layout/,/FAILED/p" build/Testing/Temporary/LastTest.log'
docker stop "$container"
I ran the same steps with debian unstable (debian:unstable@sha256:002f0db93b881359b3b6b5f0f90efb149cbb28e49932fc90e3f44be1bcab9c08) which has GCC 13.1.0 and the test fails there as well.
Slackware 15.0 mentioned in the original issue is still the latest stable slackware release. -current has gcc 13.1.0 currently and the test also fails there:
container="$(docker run --rm -d --platform linux/386 --entrypoint linux32 aclemons/slackware:current@sha256:4eaeeffac393118c8a88f6b6e6b8be83a1fb48c2bdb0db692c93d00d35ffc28b tail -f /dev/null)"
docker exec -it -e TERSE=0 -w / "$container" linux32 sh -c 'slackpkg -default_answer=yes -batch=on update && slackpkg -default_answer=yes -batch=on install binutils brotli ca-certificates cmake cyrus-sasl dcron flex gc gcc git glibc guile kernel-headers libarchive libxml2 lz4 make nghttp2 perl && c_rehash && update-ca-certificates'
docker exec -it -w / "$container" sh -c 'git clone https://github.com/Naios/function2.git'
docker exec -it -w /function2 "$container" sh -c 'git submodule update --init'
docker exec -it -w /function2 "$container" sh -c 'gcc --version'
docker exec -it -w /function2 "$container" linux32 sh -c 'mkdir build && (cd build && cmake .. && make && make -k test)'
docker exec -it -w /function2 "$container" sh -c 'sed -n "/regression_tests.size_match_layout/,/FAILED/p" build/Testing/Temporary/LastTest.log'
docker stop "$container"