This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/13944] [3.3 Regression] exception in constructor of a class to be thrown is not caught


------- Additional Comments From jason at redhat dot com  2004-03-02 20:54 -------
Subject: Re:  [3.3 Regression] exception in constructor of a
 class to be thrown is not caught

On 2 Mar 2004 20:44:22 -0000, "gdr at integrable-solutions dot net" <gcc-bugzilla@gcc.gnu.org> wrote:

>   Do you think, the patch can be backported to gcc-3_3-branch?  It
> seems to be a  patch chasing party...  

Here's the backport; I'm testing it now.

*** except.c.~1~	2004-03-01 16:25:03.000000000 -0500
--- except.c	2004-03-02 14:57:22.000000000 -0500
*************** do_allocate_exception (type)
*** 511,519 ****
  					     NULL_TREE));
  }
  
! #if 0
! /* Call __cxa_free_exception from a cleanup.  This is never invoked
!    directly, but see the comment for stabilize_throw_expr.  */
  
  static tree
  do_free_exception (ptr)
--- 511,517 ----
  					     NULL_TREE));
  }
  
! /* Call __cxa_free_exception from a cleanup.  */
  
  static tree
  do_free_exception (ptr)
*************** do_free_exception (ptr)
*** 533,539 ****
  
    return build_function_call (fn, tree_cons (NULL_TREE, ptr, NULL_TREE));
  }
- #endif
  
  /* Wrap all cleanups for TARGET_EXPRs in MUST_NOT_THROW_EXPR.
     Called from build_throw via walk_tree_without_duplicates.  */
--- 531,536 ----
*************** build_throw (exp)
*** 669,674 ****
--- 666,672 ----
        tree object, ptr;
        tree tmp;
        tree temp_expr, allocate_expr;
+       bool elided;
  
        fn = get_identifier ("__cxa_throw");
        if (IDENTIFIER_GLOBAL_VALUE (fn))
*************** build_throw (exp)
*** 723,728 ****
--- 721,728 ----
        object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr);
        object = build_indirect_ref (object, NULL);
  
+       elided = (TREE_CODE (exp) == TARGET_EXPR);
+ 
        /* And initialize the exception object.  */
        exp = build_init (object, exp, LOOKUP_ONLYCONVERTING);
        if (exp == error_mark_node)
*************** build_throw (exp)
*** 731,737 ****
  	  return error_mark_node;
  	}
  
!       exp = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (exp), exp);
        /* Prepend the allocation.  */
        exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
        if (temp_expr != void_zero_node)
--- 731,741 ----
  	  return error_mark_node;
  	}
  
!       if (elided)
! 	exp = build (TRY_CATCH_EXPR, void_type_node, exp,
! 		     do_free_exception (ptr));
!       else
! 	exp = build1 (MUST_NOT_THROW_EXPR, void_type_node, exp);
        /* Prepend the allocation.  */
        exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
        if (temp_expr != void_zero_node)


-- 


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


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