public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/18185] New: Unhandled exceptions leak
@ 2004-10-27 18:02 velco at fadata dot bg
  2004-10-27 20:29 ` [Bug libstdc++/18185] " velco at fadata dot bg
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: velco at fadata dot bg @ 2004-10-27 18:02 UTC (permalink / raw)
  To: gcc-bugs

When a thread is terminated from within an exception handling block, exception
object(s) (__cxa_exeption) are leaked, as the TSD destructor for __cxa_eh_globals
instance does delete them.  The following program demonstrates the leak.  A patch
and a ChangeLog entry follows.

#include <pthread.h>

static void *
foo (void *p)
{
  try
    {
      throw 0;
    }
  catch (int)
    {
      pthread_exit (0);
    }
}

int
main ()
{
  pthread_t t;
  void *p;

  pthread_create (&t, 0, foo, 0);
  pthread_join (t, &p);
  return 0;
}


--- /home/velco/src/gcc-4.0/libstdc++-v3/libsupc++/eh_globals.cc.~1.6.~	Tue Aug
 3 09:45:54 2004
+++ /home/velco/src/gcc-4.0/libstdc++-v3/libsupc++/eh_globals.cc	Wed Oct 27
20:50:17 2004
@@ -48,7 +48,19 @@
 get_globals_dtor (void *ptr)
 {
   if (ptr)
-    std::free (ptr);
+    {
+      __cxa_exception *exn, *next;
+
+      exn = ((__cxa_eh_globals *) ptr)->caughtExceptions;
+      while (exn)
+	{
+	  next = exn->nextException;
+	  _Unwind_DeleteException (&exn->unwindHeader);
+	  exn = next;
+	}
+
+      std::free (ptr);
+    }
 }
 
 static void

2004-10-27  Momchil Velikov  <velco@fadata.bg>

	* libsupc++/eh_globals.cc (get_globals_dtor): Delete unhandled
	exceptions.

-- 
           Summary: Unhandled exceptions leak
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: velco at fadata dot bg
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug libstdc++/18185] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
@ 2004-10-27 20:29 ` velco at fadata dot bg
  2004-10-28  4:13 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: velco at fadata dot bg @ 2004-10-27 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From velco at fadata dot bg  2004-10-27 20:29 -------
(In reply to comment #0)
> are leaked, as the TSD destructor for __cxa_eh_globals
> instance does delete them. 

I mean, of course, DOES NOT delete them.

-- 


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


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

* [Bug libstdc++/18185] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
  2004-10-27 20:29 ` [Bug libstdc++/18185] " velco at fadata dot bg
@ 2004-10-28  4:13 ` pinskia at gcc dot gnu dot org
  2004-11-01 22:31 ` bkoz at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-28  4:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-28 04:13 -------
Confirmed.  Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02389.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-28 04:13:08
               date|                            |


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


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

* [Bug libstdc++/18185] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
  2004-10-27 20:29 ` [Bug libstdc++/18185] " velco at fadata dot bg
  2004-10-28  4:13 ` pinskia at gcc dot gnu dot org
@ 2004-11-01 22:31 ` bkoz at gcc dot gnu dot org
  2004-11-01 22:47 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2004-11-01 22:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bkoz at gcc dot gnu dot org  2004-11-01 22:31 -------
Confirmed on gcc-3_4-branch as well. 

In on mainline, will fix for 3.4.4

-benjamin

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |bkoz at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
      Known to fail|                            |3.4.3
   Target Milestone|---                         |3.4.4


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


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

* [Bug libstdc++/18185] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
                   ` (2 preceding siblings ...)
  2004-11-01 22:31 ` bkoz at gcc dot gnu dot org
@ 2004-11-01 22:47 ` cvs-commit at gcc dot gnu dot org
  2004-11-08 17:41 ` [Bug libstdc++/18185] [3.4 only] " cvs-commit at gcc dot gnu dot org
  2004-11-08 18:05 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-01 22:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-01 22:47 -------
Subject: Bug 18185

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bkoz@gcc.gnu.org	2004-11-01 22:47:34

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/libsupc++: eh_globals.cc 
Added files:
	libstdc++-v3/testsuite/thread: 18185.cc 

Log message:
	2004-11-01  Momchil Velikov  <velco@fadata.bg>
	
	PR libstdc++/18185
	* libsupc++/eh_globals.cc (get_globals_dtor): Delete unhandled
	exceptions.
	* testsuite/thread/18185.cc: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2742&r2=1.2743
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/libsupc++/eh_globals.cc.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/thread/18185.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug libstdc++/18185] [3.4 only] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
                   ` (3 preceding siblings ...)
  2004-11-01 22:47 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-08 17:41 ` cvs-commit at gcc dot gnu dot org
  2004-11-08 18:05 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-08 17:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-08 17:41 -------
Subject: Bug 18185

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	bkoz@gcc.gnu.org	2004-11-08 17:41:20

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/libsupc++: eh_globals.cc 
Added files:
	libstdc++-v3/testsuite/thread: 18185.cc 

Log message:
	2004-11-08  Momchil Velikov  <velco@fadata.bg>
	
	PR libstdc++/18185
	* libsupc++/eh_globals.cc (get_globals_dtor): Delete unhandled
	exceptions.
	* testsuite/thread/18185.cc: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.195&r2=1.2224.2.196
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/libsupc++/eh_globals.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.4.16.1&r2=1.4.16.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/thread/18185.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1



-- 


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


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

* [Bug libstdc++/18185] [3.4 only] Unhandled exceptions leak
  2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
                   ` (4 preceding siblings ...)
  2004-11-08 17:41 ` [Bug libstdc++/18185] [3.4 only] " cvs-commit at gcc dot gnu dot org
@ 2004-11-08 18:05 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-08 18:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-08 18:04 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-11-08 18:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-27 18:02 [Bug libstdc++/18185] New: Unhandled exceptions leak velco at fadata dot bg
2004-10-27 20:29 ` [Bug libstdc++/18185] " velco at fadata dot bg
2004-10-28  4:13 ` pinskia at gcc dot gnu dot org
2004-11-01 22:31 ` bkoz at gcc dot gnu dot org
2004-11-01 22:47 ` cvs-commit at gcc dot gnu dot org
2004-11-08 17:41 ` [Bug libstdc++/18185] [3.4 only] " cvs-commit at gcc dot gnu dot org
2004-11-08 18:05 ` pinskia 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).