[BUG]: noconvert() causes segmentation fault with icpc
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
2.10.3
Problem description
Dear team,
When using intel 21 icpc compiler to build pybind code, the noconvert() methods seems to cause a segmentation fault at runtime :
#0 0x0000149d2a1a92b2 in pybind11::arg::noconvert (this=0x149d2a59da20 <__$U754.0.3102>, flag=true) at /visu/bmaugars/aa_Plateau_2023/help_julien/build/_deps/pybind11-src/include/pybind11/detail/../cast.h:1250
1250 flag_noconvert = flag;
[Current thread is 1 (Thread 0x149d5f8ce140 (LWP 2496202))]
Missing separate debuginfos, use: yum debuginfo-install python374-intel2120-hpc-onera-3.7.4-23.x86_64
(gdb) where
#0 0x0000149d2a1a92b2 in pybind11::arg::noconvert (this=0x149d2a59da20 <__$U754.0.3102>, flag=true) at /visu/bmaugars/aa_Plateau_2023/help_julien/build/_deps/pybind11-src/include/pybind11/detail/../cast.h:1250
#1 0x0000149d2a28dd3e in register_layouts_module (parent=...) at /visu/bmaugars/aa_Plateau_2023/help_julien/maia/maia/utils/ndarray/layouts.pybind.cpp:139
#2 0x0000149d2a2af41e in register_utils_module (parent=...) at /visu/bmaugars/aa_Plateau_2023/help_julien/maia/maia/utils/utils.pybind.cpp:15
#3 0x0000149d2a1b76c9 in _INTERNALfe1ca1b2::pybind11_init_cmaia (m=...) at /visu/bmaugars/aa_Plateau_2023/help_julien/maia/maia/cmaia.pybind.cpp:21
On the following example, discarding the last "m.def" line makes the things work correctly.
There is no issues with gcc compiler, nor with intel-llvm. It is a known problem and is there any workaround to manage it ? If not, is there any previous version that may work with intel icpc compiler ?
Thanks a lot for support
Reproducible example code
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
PYBIND11_MODULE(example, m) {
m.doc() = "pybind11 example plugin"; // optional module docstring
m.def("floats_preferred", [](double f) { return 0.5 * f; }, py::arg("f"));
m.def("floats_only", [](double f) { return 0.5 * f; }, py::arg("f").noconvert());
}
Is this a regression? Put the last known working version here if it is.
Not a regression
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The crash is reported in include/pybind11/cast.h at arg::noconvert and reproduced by the two m.def calls in the example module. First build and run that example with Intel icpc, then compare the result with GCC and intel-llvm. Done means the icpc build no longer segfaults while preserving the shown noconvert behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100