Note, the following is in reference to this Debian version of GCC: gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)
However, it also occurs under a version I have built myself: Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/usr/local/gcc-4.1 --enable-languages=c,c++,java Thread model: posix gcc version 4.1.1 My C++ knowledge isn't extensive enough to give further details of this other than it's related to string handling, or guess if it's already been reported, but the following preprocessed code reproduces the problem under -O3, but not -O2. The code performs correctly under GCC 3.4.6 and -O3 Here is the expected output: op [0]: "A" op [1]: "B" op [2]: "C" op [3]: "D" op [4]: "E" op [5]: "F" Here is a crash caught by GDB: CfgSchema (this=0xbfd0a400, [EMAIL PROTECTED]) at /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:260 260 if (__pred(*__first)) (gdb) bt #0 CfgSchema (this=0xbfd0a400, [EMAIL PROTECTED]) at /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:260 #1 0x08048ebe in main () at cfgtblopt.cpp:36 -- Summary: string processing -O3 optimization bug under GCC 4.1.1 Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter at chocky dot org GCC host triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28553