[Boost-bugs] [Boost C++ Libraries] #1127: multi_array views do not handle negative strides correctly

Subject: [Boost-bugs] [Boost C++ Libraries] #1127: multi_array views do not handle negative strides correctly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-07-28 20:24:26


#1127: multi_array views do not handle negative strides correctly
------------------------------------------+---------------------------------
 Reporter: news_at_[hidden] | Owner: garcia
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multi_array
  Version: | Severity: Problem
 Keywords: |
------------------------------------------+---------------------------------
 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

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1127>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC