From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22574 invoked by alias); 20 Feb 2003 16:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22558 invoked by uid 71); 20 Feb 2003 16:26:00 -0000 Date: Thu, 20 Feb 2003 16:26:00 -0000 Message-ID: <20030220162600.22557.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Phil Edwards Subject: Re: libstdc++/9756: __verbose_terminate_handler enters infinite loop Reply-To: Phil Edwards X-SW-Source: 2003-02/txt/msg00995.txt.bz2 List-Id: The following reply was made to PR libstdc++/9756; it has been noted by GNATS. From: Phil Edwards To: "Stephen M. Webb" Cc: gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/9756: __verbose_terminate_handler enters infinite loop Date: Thu, 20 Feb 2003 11:25:08 -0500 On Thu, Feb 20, 2003 at 11:01:23AM -0500, Stephen M. Webb wrote: > On February 19, 2003 05:04 pm, Phil Edwards wrote: > > > >How-To-Repeat: > > > > > > echo "int main() { throw 0; }" > dc.cpp > > > g++ -o dc dc.cpp > > > ./dc > > > ^C > > > > I can't reproduce this. > > I can't see how it's anything unique I've done, since gcc was built from > unmodified CVS sources for both my 3.2 and 3.4 versions. Is it possible the > problem comes from binutils (I'm using 2.13.90 20021125 for gcc 3.4) or libc > (I have 2.2.5)? Possibly, yes. > When I compile with gcc 3.2, I get expected behaviour: The sources have changed since then; in 3.2 we simply died. Now the verbose termination routine is on by default. > .... > #10212 0x400ace0d in __cxa_rethrow () at > /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_throw.cc:104 > #10213 0x400af034 in __gnu_cxx::__verbose_terminate_handler() () > at /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/vterminate.cc:81 > #10214 0x400acbf5 in __cxxabiv1::__terminate(void (*)()) ( > handler=0x400aef50 <__gnu_cxx::__verbose_terminate_handler()>) > at /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:43 > #10215 0x400acc32 in std::terminate() () at > /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:53 > #10216 0x400ace0d in __cxa_rethrow () at > /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_throw.cc:104 > #10217 0x400af034 in __gnu_cxx::__verbose_terminate_handler() () > at /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/vterminate.cc:81 > #10218 0x400acbf5 in __cxxabiv1::__terminate(void (*)()) ( > handler=0x400aef50 <__gnu_cxx::__verbose_terminate_handler()>) > at /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:43 > #10219 0x400acc32 in std::terminate() () at > /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:53 > #10220 0x400acdc2 in __cxa_throw (obj=0x400b7d59, tinfo=0x2d, dest=0x2d) > at /home/stephenw/gnu/gcc/libstdc++-v3/libsupc++/eh_throw.cc:80 > #10221 0x080484fe in main () Hmmmm. The verbose terminate handler re-throws the exception in order to try and give the user more help: // If the exception is derived from std::exception, we can give more // information. try { __throw_exception_again; } #ifdef __EXCEPTIONS catch (exception &exc) { char const *w = exc.what(); writestr(" what(): "); writestr(w); writestr("\n"); } #endif catch (...) { } The rethrow never... eh, I don't know how to express this clearly. The rethrow never rethrows; it never leaves the try block. Instead, the support routine __cxa_rethrow calles std::terminate, and there's the infinite loop. I have no idea why; the core dump I get (and the rest of us got during testing) shows this: #0 0x40124a51 in kill () from /lib/libc.so.6 #1 0x40124872 in raise () from /lib/libc.so.6 #2 0x40125986 in abort () from /lib/libc.so.6 #3 0x400a1fcb in __gnu_cxx::__verbose_terminate_handler() () at /home/pme/src/unified/libstdc++-v3/libsupc++/vterminate.cc:96 The same thing up until the rethrow; it's supposed to finish the rethrow, hit the "catch (...) { }" line, and then abort() a few lines later (line 96). Phil -- I would therefore like to posit that computing's central challenge, viz. "How not to make a mess of it," has /not/ been met. - Edsger Dijkstra, 1930-2002