This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++/4250: destructor is not called during stack unwinding after exception


The following reply was made to PR c++/4250; it has been noted by GNATS.

From: "Michal Furmanczyk" <mf@cfdrc.com>
To: <rodrigc@gcc.gnu.org>
Cc: <gcc-gnats@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>,
        <nobody@gcc.gnu.org>
Subject: Re: c++/4250: destructor is not called during stack unwinding after exception
Date: Mon, 10 Sep 2001 12:41:59 -0500

 Hi,
 
 Finally I managed to find space on my computer and installed GCC 3.0.1.
 The new version of compiler work fine, the problem not longer exists!!!
 
 Anyway, I put the complete test.cpp file below.
 I recompiled some of our programs with new compiler and
 I'm impressed with speed improvement I received (compared to egcs).
 You guys made the excellent job.
 
 I would like to signal one problem with your GCC bug reporting web page.
 It states that it is possible to make Online Test Compilation with last
 night's snapshot at Code Sourcery.
 I tried it, before I sent bug report (additionally to tests I performed on
 my own computer with GCC 3.0)
 and the binary generated from this web site fail to pass this test. So now I
 am confused.
 I suppose that the compiler used by Code Sourcery is old and suggestion form
 web page
 http://www.gnu.org/software/gcc/bugs.html#report to use it for tests of
 current compiler is misleading.
 
 Michal
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4250&database=gcc
 
 The test.cpp file:
 
 #include <iostream>
 #include <stdexcept>
 
 class Test {
 public:
   Test() { std::cerr << "ctor called" << std::endl; }
   ~Test() { std::cerr << "dtor called" << std::endl; }
 };
 
 void e() {
   // it can throw anything
   throw std::logic_error("test");
 }
 
 void f() {
   Test t;
   try {
     e();
   }
   catch(std::runtime_error&) {
   // this should not catch exception from e function
   // if exception is catch at the first try-catch block
   // containing throw point code generated by GCC work correctly
   }
 }
 
 int main() {
   try {
     f();
   }
   catch(std::exception&) {
   // exception is catch here, outside of f function
   // it means t should be already destroyed
   }
   return 0;
 }
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]