The bug is present in the 4.2.0 release and still in the 20070523 snapshot.
It was not present in 4.2-20070405-1 (from Debian experimental).

The error occured in a program using stxxl (http://stxxl.sourceforge.net) with
mcstl (http://algo2.iti.uni-karlsruhe.de/singler/mcstl/). Since mcstl requires
openmp, this can't be tested with g++ earlier than 4.2, although the problem
does not look openmp related and it should be possible to produce a test case
without mcstl/openmp dependency.

I minimized the testcase to the following:

#include <sstream>
void f () {
  std::ostringstream str_;
  str_ << "x";
  throw std::ios_base::failure(str_.str());
}

and compiled it with

/data/gcc/snapshot-4.2/bin/g++ -W -Wall -I /home/andreas/work/mpi/mcstl/c++ -I
/home/andreas/work/mpi/mcstl/originals/_data_gcc_snapshot-4.2_include_c++_4.2.1
-c -O[23] t.cpp

(.../mcstl/originals/_data_gcc_snapshot-4.2_include_c++_4.2.1/original is a
symlink to /data/gcc/snapshot-4.2/include/c++/4.2.1 and required by mcstl to
find the original STL headers, since mcstl wraps the STL headers in order to
provide parallelism)

Compiling with -O2 succeeds, while -O3 fails with

/data/gcc/snapshot-4.2/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/ostream_insert.h:
In function ‘void std::__ostream_fill(std::basic_ostream<_CharT, _Traits>&,
std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]’:
/data/gcc/snapshot-4.2/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/ostream_insert.h:96:
  instantiated from ‘std::basic_ostream<_CharT, _Traits>&
std::__ostream_insert(std::basic_ostream<_CharT, _Traits>&, const _CharT*,
std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]’
/home/andreas/work/mpi/mcstl/originals/_data_gcc_snapshot-4.2_include_c++_4.2.1/original/ostream:517:
  instantiated from ‘std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits
= std::char_traits<char>]’
t.cpp:7:   instantiated from here
/data/gcc/snapshot-4.2/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/ostream_insert.h:64:
error: ‘struct std::basic_ostream<char, std::char_traits<char> >’ has no member
named ‘fill’


-- 
           Summary: g++ -O3 fails on code that compiles with -O2
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at abeckmann dot de
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32072

Reply via email to