Open kloczek opened 3 years ago
Just found that test suite is OK when I'm not using LTO optimisation. In below log are as well some pytest warnings
============================= test session starts ==============================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/pybind11-2.6.2/tests, configfile: pytest.ini
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, cov-2.11.1, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, pyfakefs-4.4.0, freezegun-0.4.2, cases-3.4.6, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, mock-3.6.0, hypothesis-6.12.0, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, flaky-3.7.0, requests-mock-1.9.2
collected 439 items
../../tests/test_async.py .. [ 0%]
../../tests/test_buffers.py ......... [ 2%]
../../tests/test_builtin_casters.py ................... [ 6%]
../../tests/test_call_policies.py ........ [ 8%]
../../tests/test_callbacks.py ......... [ 10%]
../../tests/test_chrono.py ........................................... [ 20%]
../../tests/test_class.py ............................. [ 27%]
../../tests/test_constants_and_functions.py ..... [ 28%]
../../tests/test_copy_move.py ....... [ 29%]
../../tests/test_custom_type_casters.py .. [ 30%]
../../tests/test_docstring_options.py . [ 30%]
../../tests/test_eigen.py ....................ss... [ 36%]
../../tests/test_enum.py ....... [ 37%]
../../tests/test_eval.py ... [ 38%]
../../tests/test_exceptions.py ......... [ 40%]
../../tests/test_factory_constructors.py ............... [ 43%]
../../tests/test_gil_scoped.py ..... [ 45%]
../../tests/test_iostream.py ............. [ 48%]
../../tests/test_kwargs_and_defaults.py ........ [ 49%]
../../tests/test_local_bindings.py .......... [ 52%]
../../tests/test_methods_and_attributes.py .................... [ 56%]
../../tests/test_modules.py ...... [ 58%]
../../tests/test_multiple_inheritance.py ........... [ 60%]
../../tests/test_numpy_array.py ........................................ [ 69%]
........ [ 71%]
../../tests/test_numpy_dtypes.py ............... [ 74%]
../../tests/test_numpy_vectorize.py ........ [ 76%]
../../tests/test_opaque_types.py ... [ 77%]
../../tests/test_operator_overloading.py .... [ 78%]
../../tests/test_pickling.py ..... [ 79%]
../../tests/test_pytypes.py ................................ [ 86%]
../../tests/test_sequences_and_iterators.py ........ [ 88%]
../../tests/test_smart_ptr.py ............. [ 91%]
../../tests/test_stl.py .........s........ [ 95%]
../../tests/test_stl_binders.py ......... [ 97%]
../../tests/test_tagbased_polymorphic.py . [ 97%]
../../tests/test_union.py . [ 98%]
../../tests/test_virtual_functions.py ........ [100%]
=============================== warnings summary ===============================
test_builtin_casters.py::test_int_convert
/home/tkloczko/rpmbuild/BUILD/pybind11-2.6.2/tests/test_builtin_casters.py:302: DeprecationWarning: an integer is required (got type Int). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
assert convert(Int()) == 42
test_builtin_casters.py::test_numpy_int_convert
/home/tkloczko/rpmbuild/BUILD/pybind11-2.6.2/tests/test_builtin_casters.py:332: DeprecationWarning: an integer is required (got type numpy.float32). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
assert convert(np.float32(3.14159)) == 3
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
SKIPPED [1] ../../tests/test_eigen.py:711: could not import 'scipy': No module named 'scipy'
SKIPPED [1] ../../tests/test_eigen.py:721: could not import 'scipy': No module named 'scipy'
SKIPPED [1] ../../tests/test_stl.py:137: no <experimental/optional>
================= 436 passed, 3 skipped, 2 warnings in 24.09s ==================
To reproduce crash with LTO please try to use below script. I'm usimg gcc 11.1.0.
CFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
CXXFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
FFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
FCFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -flto=auto -flto-partition=none -fuse-linker-plugin'
CC=/usr/bin/gcc
CXX=/usr/bin/g++
FC=/usr/bin/gfortran
AR=/usr/bin/gcc-ar
NM=/usr/bin/gcc-nm
RANLIB=/usr/bin/gcc-ranlib
export CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS CC CXX FC AR NM RANLIB
/usr/bin/cmake -B x86_64-redhat-linux-gnu -D BUILD_SHARED_LIBS=ON -D CMAKE_AR=/usr/bin/gcc-ar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS_RELEASE=-DNDEBUG -D CMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -D CMAKE_Fortran_FLAGS_RELEASE=-DNDEBUG -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_NM=/usr/bin/gcc-nm -D CMAKE_RANLIB=/usr/bin/gcc-ranlib -D CMAKE_VERBOSE_MAKEFILE=ON -D DBUILD_SHARED_LIBS=ON -D INCLUDE_INSTALL_DIR=/usr/include -D LIB_INSTALL_DIR=/usr/lib64 -D LIB_SUFFIX=64 -D SHARE_INSTALL_PREFIX=/usr/share -D SYSCONF_INSTALL_DIR=/etc -S . -D PYBIND11_CUDA_TESTS=OFF -D PYBIND11_INSTALL=ON -D PYBIND11_TEST=ON -D PYTHON_EXECUTABLE=/usr/bin/python3 -D USE_PYTHON_INCLUDE_DIR=OFF
/usr/bin/cmake --build x86_64-redhat-linux-gnu --verbose
/usr/bin/make -O V=1 VERBOSE=1 check -C x86_64-redhat-linux-gnu
I have also encountered the same situation. I would like to ask if there is any progress?