[c++patch] PR#7

Nathan Sidwell nathan@codesourcery.com
Wed Mar 8 07:50:00 GMT 2000


Hi,
here's a patch for PR#7 concerning a seg fault on catching a virtually
derived object.

Although we correctly freed the original pointer, we didn't destruct it.

I'm going to stick the testcase in as g++.bugs/pr7.C, unless anyone
objects.

ok?

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-03-08  Nathan Sidwell  <nathan@codesourcery.com>

	* exception.cc (__cp_pop_exception): Cleanup the original object.

Index: cp/exception.cc
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/exception.cc,v
retrieving revision 1.29
diff -c -3 -p -r1.29 exception.cc
*** exception.cc	2000/02/26 20:15:45	1.29
--- exception.cc	2000/03/08 15:13:59
*************** __cp_pop_exception (cp_eh_info *p)
*** 252,261 ****
  
    if (p->cleanup)
      /* 2 is a magic value for destructors; see build_delete().  */
!     p->cleanup (p->value, 2);
  
    if (! __is_pointer (p->type))
!     __eh_free (p->original_value);  // value may have been co-erced.
  
    __eh_free (p);
  }
--- 252,261 ----
  
    if (p->cleanup)
      /* 2 is a magic value for destructors; see build_delete().  */
!     p->cleanup (p->original_value, 2);  // value may have been adjusted.
  
    if (! __is_pointer (p->type))
!     __eh_free (p->original_value);  // value may have been adjusted.
  
    __eh_free (p);
  }


More information about the Gcc-patches mailing list