Describe the bug
It appears a loop counter variable i shadows another loop counter variable with the same name, used to iterate an outer loop. This would be fine, but the outer loop variable is used in the scope of the inner loop as well, so the wrong variable is being used erroneously. This most likely results in the wrong behaviour, but can also occasionally result in reading off the end of the vector and unallocated memory being accessed, which is reported by valgrind as an invalid memory access. This usually has no immediate effect but can cause crashes further down the line, especially when memory is being freed.
https://github.com/hungpham2511/toppra/blob/a70f6a217ddf20c42b62471ab52ce16884a320c1/cpp/src/toppra/solver/seidel.cpp#L326-L327
I'm not 100% sure of the solution, but I think it should probably look something like this instead:
for (int k = 0; k < m_A[i].rows(); ++k)
m_index_map[k] = k;
Describe the bug It appears a loop counter variable
i
shadows another loop counter variable with the same name, used to iterate an outer loop. This would be fine, but the outer loop variable is used in the scope of the inner loop as well, so the wrong variable is being used erroneously. This most likely results in the wrong behaviour, but can also occasionally result in reading off the end of the vector and unallocated memory being accessed, which is reported by valgrind as an invalid memory access. This usually has no immediate effect but can cause crashes further down the line, especially when memory is being freed. https://github.com/hungpham2511/toppra/blob/a70f6a217ddf20c42b62471ab52ce16884a320c1/cpp/src/toppra/solver/seidel.cpp#L326-L327I'm not 100% sure of the solution, but I think it should probably look something like this instead:
Version Tip of develop.