This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[970929] Can't throw in constructor
- To: egcs at cygnus dot com
- Subject: [970929] Can't throw in constructor
- From: Chip Salzenberg <chip at rio dot atlantic dot net>
- Date: Mon, 6 Oct 1997 20:52:20 -0400 (EDT)
- Reply-To: chip at pobox dot com
Good news: Debian finally has a glibc 2.0.5c, so I can use
egcs-970929:
Reading specs from /usr/local/lib/gcc-lib/i486-pc-linux-gnu/egcs-2.90.11/specs
gcc version egcs-2.90.11 970929 (gcc2-970802 experimental)
# This directory was configured as follows:
SRC/configure --host=i486-pc-linux-gnu --program-transform-name=s,^,s, \
--norecursion
# using "SRC/config/mt-linux"
Bad news: My exception-in-constructor test case fails. (It's compiled
with "-g", no optimization, with "-frtti":
-----------------------------------------------------------------------
#include <iostream.h>
#include <sys/types.h>
char x[100];
class Noisy {
public:
Noisy() { throw "Aaaaah!"; }
void * operator new (size_t)
{ cout << "Noisy::new" << endl; return x; }
void operator delete (void *, size_t)
{ cout << "Noisy::delete" << endl; }
};
void
foo()
{
Noisy *p = 0;
try {
p = new Noisy;
delete p;
}
catch (...) {
cout << "Can't be noisy" << endl;
}
}
main()
{
foo();
}
-----------------------------------------------------------------------
Script started on Mon Oct 6 16:28:57 1997
$ gdb ./tt
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16.patched (i586-debian-linux),
Copyright 1996 Free Software Foundation, Inc...
(gdb) run
Starting program: ./tt
Noisy::new
Program received signal SIGABRT, Aborted.
0x400420a1 in kill ()
Current language: auto; currently c
(gdb) where
#0 0x400420a1 in kill ()
#1 0x40041ebf in gsignal ()
#2 0x400430ef in abort ()
#3 0x804f465 in copy_reg (reg=16, udata=0xbffffb64, target_udata=0xbffffaf4)
#4 0x804f709 in __throw ()
#5 0x804a180 in foo () at tt.cc:21
#6 0x804a2d8 in main () at tt.cc:31
(gdb) print ((frame_state *)0xbfffb64)->saved[16]
Cannot access memory at address 0xbfffbd0.
(gdb) print ((frame_state *)0xbffffb64)->saved[16]
$1 = 1 '\001'
(gdb) print ((frame_state *)0xbffffaf4)->saved[16]
$2 = 0 '\000'
(gdb) q
The program is running. Quit anyway (and kill it)? (y or n) y
$
Script done on Mon Oct 6 16:30:15 1997
-----------------------------------------------------------------------
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"He's Mr. Big of 'Big And Tall' fame." // MST3K