public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22508] New: Segmentation fault or EXC_BAD_ACCESS with modified Eckel sample code
@ 2005-07-16  3:47 flash at pobox dot com
  2005-07-16  4:01 ` [Bug c++/22508] " flash at pobox dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: flash at pobox dot com @ 2005-07-16  3:47 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3416 bytes --]

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


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <bug-22508-8581@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2005-10-20 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-16  3:47 [Bug c++/22508] New: Segmentation fault or EXC_BAD_ACCESS with modified Eckel sample code flash at pobox dot com
2005-07-16  4:01 ` [Bug c++/22508] " flash at pobox dot com
2005-07-16  4:32 ` [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new pinskia at gcc dot gnu dot org
2005-07-23  5:02 ` pinskia at gcc dot gnu dot org
2005-08-05 14:29 ` reichelt at gcc dot gnu dot org
2005-08-08 17:03 ` cvs-commit at gcc dot gnu dot org
2005-08-08 17:06 ` cvs-commit at gcc dot gnu dot org
2005-08-08 17:07 ` reichelt at gcc dot gnu dot org
     [not found] <bug-22508-8581@http.gcc.gnu.org/bugzilla/>
2005-10-20 10:10 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).