The following code, when compiled using optimization (-O1, at least), produces a segfault after several iterations of the loop. I have reproduced the bug on two machines running the same OS and version of gcc:
$ gcc -v Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-3) The code was compiled as: $ g++ -O1 -o bug bug.cc And run as: $ ./bug Segmentation fault #include <stdexcept> int main() { while (true) { try { throw std::runtime_error("foo"); } catch (const std::runtime_error& e) { } } return 0; } -- Summary: Segfault after repeated throwing and catching of runtime_error exception with error string Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cdewey at biostat dot wisc dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29432