[Boost-bugs] [Boost C++ Libraries] #3282: Assertion when resizing empty multi_array

Subject: [Boost-bugs] [Boost C++ Libraries] #3282: Assertion when resizing empty multi_array
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-07-22 11:06:11


#3282: Assertion when resizing empty multi_array
-----------------------------------------------------+----------------------
 Reporter: John Reid <j.reid@…> | Owner: garcia
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: multi_array
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-----------------------------------------------------+----------------------
 Resizing an empty array no longer seems to work. My code worked fine with
 boost 1.38, now it causes an assertion with the latest boost trunk from
 svn. The code is:
 {{{
 #include <boost/multi_array.hpp>

 int
 main( int argc, char * argv[] ) {
     boost::multi_array< double, 2 > a;
     a.resize( boost::extents[2][3] );
     return 0;
 }
 }}}

 The assertion is:
 {{{
 multi_array_resize: /home/john/Dev/ThirdParty/boost/boost-
 trunk/boost/multi_array/base.hpp:446: ArrayRef
 boost::detail::multi_array::multi_array_impl_base<T,
 NumDims>::generate_array_view(boost::type<Reference>, const
 boost::detail::multi_array::index_gen<NumDims, NDims>&, const typename
 boost::detail::multi_array::associated_types<T, mpl_::size_t<NumDims>
>::size_type*, const typename
 boost::detail::multi_array::associated_types<T, mpl_::size_t<NumDims>
>::index*, const typename boost::detail::multi_array::associated_types<T,
 mpl_::size_t<NumDims> >::index*, TPtr) const [with ArrayRef =
 boost::detail::multi_array::multi_array_view<double, 2ul>, int NDims = 2,
 TPtr = double*, T = double, long unsigned int NumDims = 2ul]: Assertion
 `index_bases[n] <= start && start < index_bases[n]+index(extents[n])'
 failed.
 Aborted
 }}}

 My compiler is:
 {{{
 john_at_john-dell:~/Dev/MyProjects/Bio/hmm$ gcc -v
 Using built-in specs.
 Target: x86_64-linux-gnu
 Configured with: ../src/configure -v --with-pkgversion='Ubuntu
 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
 --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-
 shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
 --enable-threads=posix --enable-nls --with-gxx-include-
 dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu
 --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-
 tune=generic --enable-checking=release --build=x86_64-linux-gnu
 --host=x86_64-linux-gnu --target=x86_64-linux-gnu
 Thread model: posix
 gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
 }}}

 I updated from svn today.

 I think the code creates a view on the old data in order to retain it. The
 assertion happens because this view is empty.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3282>
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:50:00 UTC