test transform failed to die
Opened this issue · 0 comments
SijmenHuizenga commented
In our workspace we run: catkin build --verbose minkindr --catkin-make-args run_tests
. This test is failing:
with the following error
ws/src/minkindr/minkindr/test/test-transformation.cc:84: Failure
Death test: T.transform(vempty)
Result: failed to die.
Error msg:
[ DEATH ]
[ FAILED ] MinKindrTests.testTransform (0 ms)
meaning that T.transform(vempty)
is expected to crash, but it doesn't.
To investigate I changed the test to the following:
EXPECT_DEATH({
std::cout << "Before transform" << std::endl;
auto test = T.transform(vempty);
std::cout << "After transform" << std::endl;
std::cout << test << std::endl;
std::cout << "After print";
}, "^");
and it outputs this:
[ RUN ] MinKindrTests.testTransform
Before transform
[ OK ] MinKindrTests.testTransform (85 ms)
Meaning that T.transform(vempty); crashed! Just as the original test expected.
So my theory is that the compiler (or Eigen?) does optimization that causes T.transform(vempty)
not to execute. Maybe because the result of T.transform(vempty)
is not used anyway? Does anyone have an idea what's going on here?
Setup:
Ubuntu clang version 14.0.6-++20220622053019+f28c006a5895-1~exp1~20220622173056.159
Target: x86_64-pc-linux-gnu
std=c++11
libeigen3-dev 3.3.4-4