[multi_array] Assertion when resizing empty array

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@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. Regards, John.

John Reid <j.reid <at> mail.cryst.bbk.ac.uk> writes:
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; }
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.
Regards, John.
It appears to be a bug. See http://www.boost.org/development/tests/trunk/developer/issues_release_.html#... Hopefully it will be fixed soon. I had same problem. I rolled boost/multi_array.hpp back to revision 41257 and it works for me now. Mikhail

Mikhail Levin <svarneticist <at> gmail.com> writes:
I had same problem. I rolled boost/multi_array.hpp back to revision 41257 and it works for me now.
Sorry. I meant to say, I switched boost/multi_array/base.hpp to revision 38482.
participants (2)
-
John Reid
-
Mikhail Levin