Re: [Boost-bugs] [Boost C++ Libraries] #8438: vector & circular_buffer storage misbehave when using compiler optimizations

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8438: vector & circular_buffer storage misbehave when using compiler optimizations
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-21 18:49:42


#8438: vector & circular_buffer storage misbehave when using compiler
optimizations
-------------------------------+--------------------------------------------
  Reporter: ofir | Owner: jano_gaspar
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: circular_buffer
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------------------------
Description changed by viboes:

Old 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.

New 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.

--
-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8438#comment:3>
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:13 UTC