------- Comment #3 from rguenth at gcc dot gnu dot org  2008-03-15 10:57 -------
This is an endless recursion during parsing (which blows the stack).  Note
that gcc 4.3 complains about a missing argument to for_each:

/usr/include/c++/4.3/bits/stl_algo.h: In function ‘_Funct std::for_each(_IIter,
_IIter, _Funct) [with _IIter =
__gnu_cxx::__normal_iterator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >, _Funct = void (*)(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&, const std::locale&)]’:
trim-bug.cc:12:   instantiated from here
/usr/include/c++/4.3/bits/stl_algo.h:3791: error: too few arguments to function

ICC ICEs:

icpc -S -o /dev/null t.cpp -cxxlib=/usr/local/gcc42
/usr/local/gcc42/include/c++/4.2.0/bits/stl_algo.h(159): internal error:
assertion failed: copy_default_arg_expr: rout NULL, no error
(shared/edgcpfe/il.c, line 13678)

        __f(*__first);
                    ^

compilation aborted for t.cpp (code 4)

so I guess your program is invalid and the gcc crash was fixed with gcc 4.3.0
(maybe we have a dup for this somewhere).

To quote for the interested reader, this is the core of the testcase:

int main()
{
  std::vector<std::string> stringvector;
  stringvector.push_back(" fred ");
  stringvector.push_back(" ethel ");

  std::for_each<std::vector<std::string>::iterator>(stringvector.begin(),
          stringvector.end(),
          boost::algorithm::trim<std::string>);
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |3.3.6 4.1.3 4.2.3
      Known to work|                            |4.3.0


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

Reply via email to