Opened 15 years ago
Closed 15 years ago
#1127 closed Bugs (fixed)
multi_array views do not handle negative strides correctly
Reported by: | Owned by: | Ronald Garcia | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multi_array |
Version: | Severity: | Problem | |
Keywords: | Cc: |
Description
Discovered in 1.33.1, but the code appears to be unchanged in 1.34.1.
The attached test case fails. Compiling with FUDGED_RANGE causes the test case to work, but it shouldn't. The problem appears to be due to generate_array_view in boost/multi_array/base.hpp; it does not correctly handle negative strides.
"len" is incorrectly calculated in the following code, when stride (and hence index_factor) is negative:
index index_factor = current_range.stride(); index len = (finish - start + (index_factor - 1)) / index_factor;
I was initially unsure as to whether negative strides were supported, but it is clear from other code in base.hpp that stride sign is carefully handled, so I it should be in the view.
Phil Richards
Attachments (1)
Change History (2)
by , 15 years ago
Attachment: | test_multi_array_view_neg_stride.cpp added |
---|
comment:1 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Test case for mutli_array view with negative stride