[Boost-bugs] [Boost C++ Libraries] #5352: BOOST_REVERSE_FOREACH does not work with boost::counting_iterator (gcc 4.5.0 and 4.5.2 using -O3)

Subject: [Boost-bugs] [Boost C++ Libraries] #5352: BOOST_REVERSE_FOREACH does not work with boost::counting_iterator (gcc 4.5.0 and 4.5.2 using -O3)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-03-22 09:44:43


#5352: BOOST_REVERSE_FOREACH does not work with boost::counting_iterator (gcc
4.5.0 and 4.5.2 using -O3)
---------------------------------------------------------------------+------
 Reporter: Marc-Peter Schambach <Marc-Peter.Schambach@…> | Owner: eric_niebler
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: foreach
  Version: Boost 1.46.0 | Severity: Problem
 Keywords: BOOST_REVERSE_FOREACH, counting_iterator |
---------------------------------------------------------------------+------
 The following code:

 {{{
 #include <iostream>
 #include "boost/foreach.hpp"
 #include <boost/iterator/counting_iterator.hpp>
 int main(int, char**) {
   boost::counting_iterator<int> start(0), end(10);
   std::pair<boost::counting_iterator<int>, boost::counting_iterator<int> >
 iterators(start, end);
   std::cout << "Counting: ";
   BOOST_REVERSE_FOREACH(int t, iterators) {
     std::cout <<t<<" ";
   }
   std::cout << std::endl;
 }

 }}}

 works fine with gcc-4.4.5 using -O3:

 {{{
 Counting: 9 8 7 6 5 4 3 2 1 0
 }}}

 but fails for gcc-4.5.0 and gcc-4.5.2 using -O3:

 {{{
 Counting: 70263556 70263556 70263556 70263556 70263556 70263556 70263556
 70263556 70263556 70263556
 }}}

 System: i686-pc-linux-gnu

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