Closed rhanai closed 2 years ago
Thanks, I will take a look
@rhanai , I think MS compilers follow the rules more closely. I use gcc in MacOS and Ubuntu. Neither of them complained about this. But I fixed it in master, based on the specs. Please check it out
@hosseinmoein I pulled commit f7b397f2 and checked the modified test and my real case, neither of them caused assertion error in MSVC 2019. Thank you for your quick response!
Environment
MSVC 2019, Debug build
Phenomenon
When the user specifies the last element of index in the second elemnt of
Index2D<IndexType>
, get_view_by_idx(slicing) causes an assertion errorcan't dereference out of range vector iterator
. Release build, however, causes no error in real run. (But I felt some unsafety here.)Reproduce
Here is an arranged version of dataframe_tester.cc/
test_get_view_by_idx_slicing
. Only three differences from the original is the second elements of Index2D in get_data_by_idx and get_view_by_idx, and the last assertion.Process to reproduce
Run code above with assertion enabled. (In my case, Debug build in MSVC 2019)
Expected behavior
dfv returns a view with 12 rows without any assertion errors.
Current behavior:
can't dereference out of range vector iterator
Cause
The assertion occurs in the following code in DataFrame_get.tcc's line 366:
When
upper==indices_.end()
, derefereincing it by*upper
is not allowed, I think. this link saysThanks in advance.