This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-3.0 bug - destructor not called when throwing an exception
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc-3.0 bug - destructor not called when throwing an exception
- From: Ryszard Kabatek <Ryszard dot Kabatek at softax dot pl>
- Date: Fri, 27 Jul 2001 14:39:46 +0200
- Reply-To: Ryszard dot Kabatek at softax dot pl
Hi,
I saw the message below on a mailing list, perhaps it was reported to gcc-bugs.
I can reproduce the bug on linux (RedHat 7.0) with gcc-3.0.
It seems to be a serious problem.
Regards
--
Ryszard Kabatek
=========================================
The symptom is that omniNames hangs when one runs eg3_impl 1 or 2 times.
This is caused by a bug in the code generated by gcc 3.0. A simple test
case
is:
----------------------------------
#include <iostream.h>
class A {
public:
A() {
cerr << "A()" << endl;
}
~A() {
cerr << "~A()" << endl;
}
};
void f() {
A a;
try {
throw long(0);
}
catch(int&) {
cerr << "Got int exception" << endl;
}
}
int
main(int,char**) {
try {
f();
}
catch(long& v) {
cerr << "Got long " << v << endl;
}
return 0;
}
-------------
Compile the test code with gcc-3.0 on linux. Execute the program will
produce the following
output:
$ ./testcc
A()
Got long 0
The correct output is:
$ ./testcc
A()
~A()
Got long 0
The missing dtor call is fatal as this means that any resource
allocation
will not be released.
This leads to various deadlock within the ORB.
In summary, don't bother using gcc 3.0 until the bugs are fixed.
Regards,
Sai-Lai