ZJU-FAST-Lab / GCOPTER

A General-Purpose Trajectory Optimizer for Multicopters
MIT License
728 stars 147 forks source link

Alignment error in `firi.hpp` function `maxVolInsEllipsoid` #19

Closed zhangbaozhe closed 1 year ago

zhangbaozhe commented 1 year ago

I've been compiling your code in C++17 and added -fsanitize=address,undefined in debug mode to check some errors.

The executable compiled in debug mode complained of a runtime error (store to misaligned address for type 'double', which requires 8 byte alignment) around https://github.com/ZJU-FAST-Lab/GCOPTER/blob/63c5861735046079c925c6937475cb1033a51691/gcopter/include/gcopter/firi.hpp#L95 I've digged around the code, and found that https://github.com/ZJU-FAST-Lab/GCOPTER/blob/63c5861735046079c925c6937475cb1033a51691/gcopter/include/gcopter/firi.hpp#L187 this line has some alignment issue where int should be replaced with some 64-bit type such as unsigned long aka int64_t.

ZhepeiWang commented 1 year ago

Thanks!