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; 8+ 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] 8+ messages in thread

* [Bug c++/22508] Segmentation fault or EXC_BAD_ACCESS with modified Eckel sample code
  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 ` 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
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: flash at pobox dot com @ 2005-07-16  4:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From flash at pobox dot com  2005-07-16 03:47 -------
Created an attachment (id=9287)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9287&action=view)
Preprocessed source file


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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 ` pinskia at gcc dot gnu dot org
  2005-07-23  5:02 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-16  4:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-16 04:02 -------
Confirmed, reduced testcase:
typedef __SIZE_TYPE__ size_t;
struct Framis
{
  void* operator new(size_t) throw(bad_alloc);
};
Framis* x = new Framis;


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |error-recovery, ice-on-
                   |                            |invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-16 04:02:02
               date|                            |
            Summary|Segmentation fault or       |[4.0/4.1 Regression] ICE
                   |EXC_BAD_ACCESS with modified|after invalid operator new
                   |Eckel sample code           |
   Target Milestone|---                         |4.0.2


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-23  5:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-08-05 14:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-08-05 14:28 -------
Testing a patch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |reichelt at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-08 17:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-08 17:03 -------
Subject: Bug 22508

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-08-08 17:03:33

Modified files:
	gcc/cp         : ChangeLog init.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: new13.C 

Log message:
	PR c++/22508
	* init.c (build_new_1): Check for empty candidate list.
	
	* g++.dg/init/new13.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4844&r2=1.4845
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.425&r2=1.426
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5893&r2=1.5894
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new13.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-08 17:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-08 17:06 -------
Subject: Bug 22508

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	reichelt@gcc.gnu.org	2005-08-08 17:06:39

Modified files:
	gcc/cp         : ChangeLog init.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: new13.C 

Log message:
	PR c++/22508
	* init.c (build_new_1): Check for empty candidate list.
	
	* g++.dg/init/new13.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.72&r2=1.4648.2.73
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.412.2.5&r2=1.412.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.322&r2=1.5084.2.323
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new13.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/22508] [4.0/4.1 Regression] ICE after invalid operator new
  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
                   ` (5 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-08-08 17:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-08-08 17:07 -------
Fixed on mainline and 4.0 branch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-08-08 17:07 UTC | newest]

Thread overview: 8+ 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

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).