The command below results in "internal compiler error: Segmentation fault" with the checking- enabled version of GCC 4.0.1 on Suse Linux 9.2. It also crashes with Apple GCC 4.0.0 on Mac OSX 10.4.2. GCC 3.3.4 on Suse rejects the code without crashing, as does CodeSourcery arm-none-linux- gnueabi-g++ 3.4.3, our local version of arm-softfloat-linux-gnu 3.4.1, and (on OSX) Apple's GCC 3.3 and my own build of 3.4.0.
/opt/gcc401chk/bin/g++ -c ../cpp/bugfiles/error/EckelRob_104822.ii ../jammed/Barney/eckel.cpp: In function std::string EckelCode::FramisTest(): ../jammed/Barney/eckel.cpp:2039: internal compiler error: Segmentation fault With the Apple version of GCC 4.0.0, it gives a crash dialog (with a Report button which doesn't work) with the following text: The application cc1plus quit unexpectedly EXC_BAD_ACCESS (0x1) KERN_PROTECTION_FAILURE (0X2) at 0xc Thread 0 Crashed: 0 0x1000 + 457016 I'll attach the preprocessed source. It was copied by Rob Stevenson, a former PalmSource employee, from volume one of Bruce Eckel's _Thinking in C++_. Here's the relevant function: string FramisTest() { stringstream ss2; Framis* f[Framis::psize]; try { for(int i = 0; i < Framis::psize; i++) f[i] = new Framis; new Framis; // Out of memory } catch(bad_alloc) { ss2 << "Out of memory!" << endl; } delete f[10]; f[10] = 0; // Use released memory: Framis* x = new Framis; delete x; for(int j = 0; j < Framis::psize; j++) { ss2 << f[j]->ReturnStrStream() ; delete f[j]; // Delete f[10] OK } return ss2.str() ; } ///:~ ______________________________________ Configurations: Suse: 62> /opt/gcc401chk/bin/g++ -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../configure --enable-checking --prefix=/opt/gcc401chk --enable-languages=c,c+ + Thread model: posix gcc version 4.0.1 63> uname -a Linux thrallis 2.6.8-24.16-default #1 Thu Jun 2 12:09:57 UTC 2005 i686 i686 i386 GNU/Linux Macintosh: > gcc -v Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure --disable-checking --prefix=/ usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^ [cg][^+.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --build=powerpc- apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8 Thread model: posix gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061) 112> uname -a Darwin klono.local 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpc PalmSource bug #104822 --- Flash Sheridan http://pobox.com/~flash Quality Lead for Compilers and Debuggers PalmSource, Inc. Tools Quality Management -- Summary: Segmentation fault or EXC_BAD_ACCESS with modified Eckel sample code Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: flash at pobox dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22508