In cases where a robot's dimension isn't a multiple of the vector width, it was possible to attempt to store a vector with an aligned store instruction (on x86 systems) to an unaligned address when outputting a path to a numpy array, resulting in a segfault. There were also some small errors in the indexing and buffer size, which could also have caused segfaults. We didn't see these errors before because (1) luck with robot state dimensions and (2) the problem does not seem to occur on ARM systems (e.g., Macbooks), which we used to try to reproduce #9.
This PR adds an unaligned store operation to the vector backend and a to_array_unaligned method using this operation to the vector interface to, in cases like this where performance isn't critical, simply use an unaligned store to avoid the segfault. It also fixes the indexing and buffer size issues and some miscellaneous memory-related warnings that cropped up with the new version of g++.
feat: Add store_unaligned and to_array_unaligned
fix: Correct buffer alloc size for numpy methods
fix: Correct bug in path numpy loop indexing and use to_array_unaligned
misc: Cleanup (some) unused includes
fix: Correctly specify deallocation function for unique_ptr with aligned memory
Fixes #9.
In cases where a robot's dimension isn't a multiple of the vector width, it was possible to attempt to store a vector with an aligned store instruction (on x86 systems) to an unaligned address when outputting a path to a numpy array, resulting in a segfault. There were also some small errors in the indexing and buffer size, which could also have caused segfaults. We didn't see these errors before because (1) luck with robot state dimensions and (2) the problem does not seem to occur on ARM systems (e.g., Macbooks), which we used to try to reproduce #9.
This PR adds an unaligned store operation to the vector backend and a
to_array_unaligned
method using this operation to the vector interface to, in cases like this where performance isn't critical, simply use an unaligned store to avoid the segfault. It also fixes the indexing and buffer size issues and some miscellaneous memory-related warnings that cropped up with the new version ofg++
.