-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix osrm-contract, tests, on Windows #5882
Fix osrm-contract, tests, on Windows #5882
Conversation
return false; | ||
|
||
static const constexpr char fmt[sizeof...(Fmt)] = {Fmt...}; | ||
|
||
if (first + sizeof(fmt) < last && std::equal(fmt, fmt + sizeof(fmt), first + 1u)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first + sizeof(fmt)
creates iterator beyond end.
@@ -346,7 +346,7 @@ template <typename GroupBlockPolicy, storage::Ownership Ownership> struct Indexe | |||
const GroupBlockPolicy block; | |||
block.ReadRefrencedBlock(blocks[block_idx], internal_idx, first, last); | |||
|
|||
return adapt(&*first, &*last); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For empty container, *first
and *last
can both be dereferencing the end iterator.
@@ -11,9 +11,11 @@ | |||
const auto &rhs = {__VA_ARGS__}; \ | |||
BOOST_CHECK_EQUAL_COLLECTIONS(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); \ | |||
} while (0) | |||
#define CHECK_EQUAL_COLLECTIONS(lhs, rhs) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed if lhs
or rhs
is expression creating a value (e.g. a literal). begin()
and end()
would reference different containers.
@@ -38,8 +38,8 @@ void test_rw(const Offsets &offsets, const Data &data) | |||
|
|||
for (std::size_t index = 0; index < offsets.size() - 1; ++index) | |||
{ | |||
typename IndexedData::ResultType expected_result(&data[offsets[index]], | |||
&data[offsets[index + 1]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential subscript out of range.
@@ -175,4 +178,56 @@ BOOST_AUTO_TEST_CASE(mlp_sorted) | |||
BOOST_CHECK_EQUAL(mlp.EndChildren(4, 0), 2); | |||
} | |||
|
|||
BOOST_AUTO_TEST_CASE(large_cell_number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created this to detect #5878, but it also found an issue with 32 bit builds.
3aac5b3
to
2fe8334
Compare
As part of graph contraction, node renumbering leads to in-place permuting of graph state, including boolean vector elements. std::vector<bool> returns proxy objects when referencing individual bits. To correctly swap bool elements using MSVC, we need to explicitly apply std::vector<bool>::swap. Making this change fixes osrm-contract on Windows. We also correct failing tests and other undefined behaviours (mainly iterator access outside boundaries) highlighted by MSVC.
2fe8334
to
96acdaf
Compare
::XCOPY /Y corech\*.* ..\test\data\corech\ | ||
::XCOPY /Y mld\*.* ..\test\data\mld\ | ||
::unit_tests\%Configuration%\library-tests.exe | ||
ECHO running partitioner-tests.exe ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Issue
As part of graph contraction, node renumbering leads to in-place permuting of graph state, including boolean vector elements.
std::vector<bool>
returns proxy objects when referencing individual bits. To correctly swap boolean elements using MSVC, we need to explicitly applystd::vector<bool>::swap
.Making this change fixes
osrm-contract
on Windows.We also correct failing tests and other undefined behaviours (mainly iterator access outside boundaries) highlighted by MSVC.
Tasklist
Requirements / Relations
#5872 has related discussion on
osrm-contract
failing on Windows