Opened 10 years ago

Last modified 9 years ago

#8438 new Bugs

vector & circular_buffer storage misbehave when using compiler optimizations — at Initial Version

Reported by: ofir Owned by: Jan Gaspar
Milestone: To Be Determined Component: uBLAS
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc: Douglas Gregor, Jan Gaspar, ofirmebel@…

Description

When compiling the following code without optimizations, it behaves as expected: (compiled with g++-4.7.2 with no flags at all)

#include <boost/numeric/ublas/vector.hpp> #include <boost/numeric/ublas/io.hpp> #include <boost/circular_buffer.hpp>

int main () {

boost::numeric::ublas::vector<double, boost::circular_buffer<double> > v (3, 1); std::cout << v << std::endl; v[1] = 5; std::cout << v << std::endl; std::cout << v[1] << std::endl; return 0;

}

Output: [3](1,1,1) [3](1,5,1) 5

When compiling the exact same code with O1, O2, and O3 it produces the following output: [3](0,0,0) [3](0,0,0) 5

I noticed that inner_prod() also sees the vector as zeros.

Change History (0)

Note: See TracTickets for help on using tickets.