This is the mail archive of the gcc-patches@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]

C++ PATCH: Backport stabilize_call and 13944 fix to 3.4


This patch is a backport of three patches previously applied to the
tree-ssa branch:

  http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01390.html
  http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02240.html
  http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02241.html

I applied the first one only to tree-ssa because I thought that it was not
a bugfix.  However, Jan found a case which fails on 3.4 because of
CALL_EXPR sharing, which is fixed by my patch.

  http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00118.html

The fix for 13944 doesn't depend on stabilize_call, but the change is
affected by it, so I'm appling it at the same time.

Tested x86_64-pc-linux-gnu, applied to 3.4 branch.

2004-03-01  Jason Merrill  <jason@redhat.com>

	PR c++/13944
	* except.c (do_free_exception): Remove #if 0 wrapper.
	(build_throw): Use it if we elide a copy into the
	exception object.

	* tree.c (stabilize_call): Fix thinko.

	* init.c (build_new_1): Preevaluate initializer.  Simplify EH code.
	(build_init): Call a constructor rather than call build_aggr_init
	for classes.
	* except.c (stabilize_throw_expr): Remove.
	(build_throw): Use stabilize_init instead of stabilize_throw_expr.
	* tree.c (stabilize_call, stabilize_init): New fns.
	* call.c (build_over_call): A constructor no longer returns the
	address of the object.

*** ./gcc/cp/except.c.~1~	2004-03-01 16:07:36.000000000 -0500
--- ./gcc/cp/except.c	2004-03-01 16:29:13.000000000 -0500
*************** static tree do_end_catch (tree);
*** 47,53 ****
  static bool decl_is_java_type (tree decl, int err);
  static void initialize_handler_parm (tree, tree);
  static tree do_allocate_exception (tree);
- static tree stabilize_throw_expr (tree, tree *);
  static tree wrap_cleanups_r (tree *, int *, void *);
  static int complete_ptr_ref_or_void_ptr_p (tree, tree);
  static bool is_admissible_throw_operand (tree);
--- 47,52 ----
*************** do_allocate_exception (tree type)
*** 507,513 ****
  					     NULL_TREE));
  }
  
- #if 0
  /* Call __cxa_free_exception from a cleanup.  This is never invoked
     directly, but see the comment for stabilize_throw_expr.  */
  
--- 506,511 ----
*************** do_free_exception (tree ptr)
*** 526,532 ****
  
    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.  */
--- 524,529 ----
*************** wrap_cleanups_r (tree *tp, int *walk_sub
*** 558,615 ****
    return NULL_TREE;
  }
  
- /* Like stabilize_expr, but specifically for a thrown expression.  When
-    throwing a temporary class object, we want to construct it directly into
-    the thrown exception, so we look past the TARGET_EXPR and stabilize the
-    arguments of the call instead.
- 
-    The case where EXP is a call to a function returning a class is a bit of
-    a grey area in the standard; it's unclear whether or not it should be
-    allowed to throw.  I'm going to say no, as that allows us to optimize
-    this case without worrying about deallocating the exception object if it
-    does.  The alternatives would be either not optimizing this case, or
-    wrapping the initialization in a TRY_CATCH_EXPR to call do_free_exception
-    rather than in a MUST_NOT_THROW_EXPR, for this case only.  */
- 
- static tree
- stabilize_throw_expr (tree exp, tree *initp)
- {
-   tree init_expr;
- 
-   if (TREE_CODE (exp) == TARGET_EXPR
-       && TREE_CODE (TARGET_EXPR_INITIAL (exp)) == AGGR_INIT_EXPR
-       && flag_elide_constructors)
-     {
-       tree aggr_init = AGGR_INIT_EXPR_CHECK (TARGET_EXPR_INITIAL (exp));
-       tree args = TREE_OPERAND (aggr_init, 1);
-       tree newargs = NULL_TREE;
-       tree *p = &newargs;
- 
-       init_expr = void_zero_node;
-       for (; args; args = TREE_CHAIN (args))
- 	{
- 	  tree arg = TREE_VALUE (args);
- 	  tree arg_init_expr;
- 
- 	  arg = stabilize_expr (arg, &arg_init_expr);
- 
- 	  if (TREE_SIDE_EFFECTS (arg_init_expr))
- 	    init_expr = build (COMPOUND_EXPR, void_type_node, init_expr,
- 			       arg_init_expr);
- 	  *p = tree_cons (NULL_TREE, arg, NULL_TREE);
- 	  p = &TREE_CHAIN (*p);
- 	}
-       TREE_OPERAND (aggr_init, 1) = newargs;
-     }
-   else
-     {
-       exp = stabilize_expr (exp, &init_expr);
-     }
- 
-   *initp = init_expr;
-   return exp;
- }
- 
  /* Build a throw expression.  */
  
  tree
--- 555,560 ----
*************** build_throw (tree exp)
*** 663,668 ****
--- 608,614 ----
        tree object, ptr;
        tree tmp;
        tree temp_expr, allocate_expr;
+       bool elided;
  
        fn = get_identifier ("__cxa_throw");
        if (!get_global_value_if_present (fn, &fn))
*************** build_throw (tree exp)
*** 703,713 ****
  	 the call to __cxa_allocate_exception first (which doesn't
  	 matter, since it can't throw).  */
  
-       /* Pre-evaluate the thrown expression first, since if we allocated
- 	 the space first we would have to deal with cleaning it up if
- 	 evaluating this expression throws.  */
-       exp = stabilize_throw_expr (exp, &temp_expr);
- 
        /* Allocate the space for the exception.  */
        allocate_expr = do_allocate_exception (TREE_TYPE (exp));
        allocate_expr = get_target_expr (allocate_expr);
--- 649,654 ----
*************** build_throw (tree exp)
*** 715,720 ****
--- 656,663 ----
        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 (tree exp)
*** 723,732 ****
  	  return error_mark_node;
  	}
  
!       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)
  	{
  	  /* Prepend the calculation of the throw expression.  Also, force
  	     any cleanups from the expression to be evaluated here so that
--- 666,695 ----
  	  return error_mark_node;
  	}
  
!       /* Pre-evaluate the thrown expression first, since if we allocated
! 	 the space first we would have to deal with cleaning it up if
! 	 evaluating this expression throws.
! 
! 	 The case where EXP the initializer is a call to a constructor or a
! 	 function returning a class is a bit of a grey area in the
! 	 standard; it's unclear whether or not it should be allowed to
! 	 throw.  We used to say no, as that allowed us to optimize this
! 	 case without worrying about deallocating the exception object if
! 	 it does.  But that conflicted with expectations (PR 13944) and the
! 	 EDG compiler; now we wrap the initialization in a TRY_CATCH_EXPR
! 	 to call do_free_exception rather than in a MUST_NOT_THROW_EXPR,
! 	 for this case only.  */
!       stabilize_init (exp, &temp_expr);
! 
!       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)
  	{
  	  /* Prepend the calculation of the throw expression.  Also, force
  	     any cleanups from the expression to be evaluated here so that
*** ./gcc/cp/call.c.~1~	2004-03-01 16:03:01.000000000 -0500
--- ./gcc/cp/call.c	2004-03-01 16:23:13.000000000 -0500
*************** build_over_call (struct z_candidate *can
*** 4552,4567 ****
        else if (TREE_CODE (arg) == TARGET_EXPR
  	       || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
  	{
- 	  tree address;
  	  tree to = stabilize_reference
  	    (build_indirect_ref (TREE_VALUE (args), 0));
  
  	  val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
! 	  address = build_unary_op (ADDR_EXPR, val, 0);
! 	  /* Avoid a warning about this expression, if the address is
! 	     never used.  */
! 	  TREE_USED (address) = 1;
! 	  return address;
  	}
      }
    else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
--- 4552,4562 ----
        else if (TREE_CODE (arg) == TARGET_EXPR
  	       || TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
  	{
  	  tree to = stabilize_reference
  	    (build_indirect_ref (TREE_VALUE (args), 0));
  
  	  val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
! 	  return val;
  	}
      }
    else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR
*** ./gcc/cp/cp-tree.h.~1~	2004-03-01 16:03:02.000000000 -0500
--- ./gcc/cp/cp-tree.h	2004-03-01 16:23:13.000000000 -0500
*************** extern void simplify_aggr_init_expr		(tr
*** 4099,4104 ****
--- 4099,4106 ----
  extern void lang_check_failed			(const char *, int,
  							 const char *);
  extern tree stabilize_expr			(tree, tree *);
+ extern void stabilize_call			(tree, tree *);
+ extern void stabilize_init			(tree, tree *);
  extern tree cxx_unsave_expr_now			(tree);
  extern tree cxx_maybe_build_cleanup		(tree);
  extern void init_tree			        (void);
*** ./gcc/cp/init.c.~1~	2004-03-01 16:03:04.000000000 -0500
--- ./gcc/cp/init.c	2004-03-01 16:27:35.000000000 -0500
*************** build_init (tree decl, tree init, int fl
*** 1150,1158 ****
  {
    tree expr;
  
!   if (IS_AGGR_TYPE (TREE_TYPE (decl))
!       || TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
      expr = build_aggr_init (decl, init, flags);
    else
      expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
  
--- 1150,1162 ----
  {
    tree expr;
  
!   if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
      expr = build_aggr_init (decl, init, flags);
+   else if (CLASS_TYPE_P (TREE_TYPE (decl)))
+     expr = build_special_member_call (decl, complete_ctor_identifier,
+ 				      build_tree_list (NULL_TREE, init),
+ 				      TYPE_BINFO (TREE_TYPE (decl)),
+ 				      LOOKUP_NORMAL|flags);
    else
      expr = build (INIT_EXPR, TREE_TYPE (decl), decl, init);
  
*************** static tree
*** 1915,1921 ****
  build_new_1 (tree exp)
  {
    tree placement, init;
!   tree true_type, size, rval, t;
    /* The type of the new-expression.  (This type is always a pointer
       type.)  */
    tree pointer_type;
--- 1919,1925 ----
  build_new_1 (tree exp)
  {
    tree placement, init;
!   tree true_type, size, rval;
    /* The type of the new-expression.  (This type is always a pointer
       type.)  */
    tree pointer_type;
*************** build_new_1 (tree exp)
*** 1956,1961 ****
--- 1960,1966 ----
       address of the first array element.  This node is a VAR_DECL, and
       is therefore reusable.  */
    tree data_addr;
+   tree init_preeval_expr = NULL_TREE;
  
    placement = TREE_OPERAND (exp, 0);
    type = TREE_OPERAND (exp, 1);
*************** build_new_1 (tree exp)
*** 2124,2141 ****
       placement delete.  */
    if (placement_allocation_fn_p)
      {
!       tree inits = NULL_TREE;
!       t = TREE_CHAIN (TREE_OPERAND (alloc_call, 1));
!       for (; t; t = TREE_CHAIN (t))
! 	if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
! 	  {
! 	    tree init;
! 	    TREE_VALUE (t) = stabilize_expr (TREE_VALUE (t), &init);
! 	    if (inits)
! 	      inits = build (COMPOUND_EXPR, void_type_node, inits, init);
! 	    else
! 	      inits = init;
! 	  }
        if (inits)
  	alloc_expr = build (COMPOUND_EXPR, TREE_TYPE (alloc_expr), inits,
  			    alloc_expr);
--- 2129,2136 ----
       placement delete.  */
    if (placement_allocation_fn_p)
      {
!       tree inits;
!       stabilize_call (alloc_call, &inits);
        if (inits)
  	alloc_expr = build (COMPOUND_EXPR, TREE_TYPE (alloc_expr), inits,
  			    alloc_expr);
*************** build_new_1 (tree exp)
*** 2178,2191 ****
        data_addr = alloc_node;
      }
  
!   /* Now initialize the allocated object.  */
    if (is_initialized)
      {
        init_expr = build_indirect_ref (data_addr, NULL);
  
        if (init == void_zero_node)
  	init = build_default_init (full_type, nelts);
!       else if (init && pedantic && has_array)
  	pedwarn ("ISO C++ forbids initialization in array new");
  
        if (has_array)
--- 2173,2190 ----
        data_addr = alloc_node;
      }
  
!   /* Now initialize the allocated object.  Note that we preevaluate the
!      initialization expression, apart from the actual constructor call or
!      assignment--we do this because we want to delay the allocation as long
!      as possible in order to minimize the size of the exception region for
!      placement delete.  */
    if (is_initialized)
      {
        init_expr = build_indirect_ref (data_addr, NULL);
  
        if (init == void_zero_node)
  	init = build_default_init (full_type, nelts);
!       else if (init && has_array)
  	pedwarn ("ISO C++ forbids initialization in array new");
  
        if (has_array)
*************** build_new_1 (tree exp)
*** 2195,2204 ****
  						integer_one_node),
  			    init, /*from_array=*/0);
        else if (TYPE_NEEDS_CONSTRUCTING (type))
! 	init_expr = build_special_member_call (init_expr, 
! 					       complete_ctor_identifier,
! 					       init, TYPE_BINFO (true_type),
! 					       LOOKUP_NORMAL);
        else
  	{
  	  /* We are processing something like `new int (10)', which
--- 2194,2206 ----
  						integer_one_node),
  			    init, /*from_array=*/0);
        else if (TYPE_NEEDS_CONSTRUCTING (type))
! 	{
! 	  init_expr = build_special_member_call (init_expr, 
! 						 complete_ctor_identifier,
! 						 init, TYPE_BINFO (true_type),
! 						 LOOKUP_NORMAL);
! 	  stabilize_init (init_expr, &init_preeval_expr);
! 	}
        else
  	{
  	  /* We are processing something like `new int (10)', which
*************** build_new_1 (tree exp)
*** 2206,2220 ****
  
  	  if (TREE_CODE (init) == TREE_LIST)
  	    init = build_x_compound_expr_from_list (init, "new initializer");
! 	  
  	  else if (TREE_CODE (init) == CONSTRUCTOR
  		   && TREE_TYPE (init) == NULL_TREE)
! 	    {
! 	      pedwarn ("ISO C++ forbids aggregate initializer to new");
! 	      init = digest_init (type, init, 0);
! 	    }
  
  	  init_expr = build_modify_expr (init_expr, INIT_EXPR, init);
  	}
  
        if (init_expr == error_mark_node)
--- 2208,2220 ----
  
  	  if (TREE_CODE (init) == TREE_LIST)
  	    init = build_x_compound_expr_from_list (init, "new initializer");
! 
  	  else if (TREE_CODE (init) == CONSTRUCTOR
  		   && TREE_TYPE (init) == NULL_TREE)
! 	    abort ();
  
  	  init_expr = build_modify_expr (init_expr, INIT_EXPR, init);
+ 	  stabilize_init (init_expr, &init_preeval_expr);
  	}
  
        if (init_expr == error_mark_node)
*************** build_new_1 (tree exp)
*** 2244,2294 ****
  					  (placement_allocation_fn_p 
  					   ? alloc_call : NULL_TREE));
  
! 	  /* Ack!  First we allocate the memory.  Then we set our sentry
! 	     variable to true, and expand a cleanup that deletes the memory
! 	     if sentry is true.  Then we run the constructor, and finally
! 	     clear the sentry.
! 
! 	     It would be nice to be able to handle this without the sentry
! 	     variable, perhaps with a TRY_CATCH_EXPR, but this doesn't
! 	     work.  We allocate the space first, so if there are any
! 	     temporaries with cleanups in the constructor args we need this
! 	     EH region to extend until end of full-expression to preserve
! 	     nesting.
! 
! 	     If the backend had some mechanism so that we could force the
! 	     allocation to be expanded after all the other args to the
! 	     constructor, that would fix the nesting problem and we could
! 	     do away with this complexity.  But that would complicate other
! 	     things; in particular, it would make it difficult to bail out
! 	     if the allocation function returns null.  Er, no, it wouldn't;
! 	     we just don't run the constructor.  The standard says it's
! 	     unspecified whether or not the args are evaluated.
! 
! 	     FIXME FIXME FIXME inline invisible refs as refs.  That way we
! 	     can preevaluate value parameters.  */
! 
  	  if (cleanup)
! 	    {
! 	      tree end, sentry, begin;
! 
! 	      begin = get_target_expr (boolean_true_node);
! 	      CLEANUP_EH_ONLY (begin) = 1;
! 
! 	      sentry = TARGET_EXPR_SLOT (begin);
! 
! 	      TARGET_EXPR_CLEANUP (begin)
! 		= build (COND_EXPR, void_type_node, sentry,
! 			 cleanup, void_zero_node);
! 
! 	      end = build (MODIFY_EXPR, TREE_TYPE (sentry),
! 			   sentry, boolean_false_node);
! 
! 	      init_expr
! 		= build (COMPOUND_EXPR, void_type_node, begin,
! 			 build (COMPOUND_EXPR, void_type_node, init_expr,
! 				end));
! 	    }
  	}
      }
    else
--- 2244,2254 ----
  					  (placement_allocation_fn_p 
  					   ? alloc_call : NULL_TREE));
  
! 	  /* This is much simpler now that we've preevaluated all of the
! 	     arguments to the constructor call.  */
  	  if (cleanup)
! 	    init_expr = build (TRY_CATCH_EXPR, void_type_node,
! 			       init_expr, cleanup);
  	}
      }
    else
*************** build_new_1 (tree exp)
*** 2321,2326 ****
--- 2281,2289 ----
        rval = build (COMPOUND_EXPR, TREE_TYPE (rval), alloc_expr, rval);
      }
  
+   if (init_preeval_expr)
+     rval = build (COMPOUND_EXPR, TREE_TYPE (rval), init_preeval_expr, rval);
+ 
    /* Convert to the final type.  */
    rval = build_nop (pointer_type, rval);
  
*** ./gcc/cp/tree.c.~1~	2004-03-01 16:03:09.000000000 -0500
--- ./gcc/cp/tree.c	2004-03-01 16:28:40.000000000 -0500
*************** stabilize_expr (tree exp, tree* initp)
*** 2429,2435 ****
  
    if (!TREE_SIDE_EFFECTS (exp))
      {
!       init_expr = void_zero_node;
      }
    else if (!real_lvalue_p (exp)
  	   || !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)))
--- 2429,2435 ----
  
    if (!TREE_SIDE_EFFECTS (exp))
      {
!       init_expr = NULL_TREE;
      }
    else if (!real_lvalue_p (exp)
  	   || !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)))
*************** stabilize_expr (tree exp, tree* initp)
*** 2448,2453 ****
--- 2448,2520 ----
    *initp = init_expr;
    return exp;
  }
+ 
+ /* Like stabilize_expr, but for a call whose args we want to
+    pre-evaluate.  */
+ 
+ void
+ stabilize_call (tree call, tree *initp)
+ {
+   tree inits = NULL_TREE;
+   tree t;
+ 
+   if (call == error_mark_node)
+     return;
+ 
+   if (TREE_CODE (call) != CALL_EXPR
+       && TREE_CODE (call) != AGGR_INIT_EXPR)
+     abort ();
+ 
+   for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
+     if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
+       {
+ 	tree init;
+ 	TREE_VALUE (t) = stabilize_expr (TREE_VALUE (t), &init);
+ 	if (!init)
+ 	  /* Nothing.  */;
+ 	else if (inits)
+ 	  inits = build (COMPOUND_EXPR, void_type_node, inits, init);
+ 	else
+ 	  inits = init;
+       }
+ 
+   *initp = inits;
+ }
+ 
+ /* Like stabilize_expr, but for an initialization.  If we are initializing
+    an object of class type, we don't want to introduce an extra temporary,
+    so we look past the TARGET_EXPR and stabilize the arguments of the call
+    instead.  */
+ 
+ void
+ stabilize_init (tree init, tree *initp)
+ {
+   tree t = init;
+ 
+   if (t == error_mark_node)
+     return;
+ 
+   if (TREE_CODE (t) == INIT_EXPR
+       && TREE_CODE (TREE_OPERAND (t, 1)) != TARGET_EXPR)
+     TREE_OPERAND (t, 1) = stabilize_expr (TREE_OPERAND (t, 1), initp);
+   else
+     {
+       if (TREE_CODE (t) == INIT_EXPR)
+ 	t = TREE_OPERAND (t, 1);
+       if (TREE_CODE (t) == TARGET_EXPR)
+ 	t = TARGET_EXPR_INITIAL (t);
+       if (TREE_CODE (t) == CONSTRUCTOR
+ 	  && CONSTRUCTOR_ELTS (t) == NULL_TREE)
+ 	{
+ 	  /* Default-initialization.  */
+ 	  *initp = NULL_TREE;
+ 	  return;
+ 	}
+ 
+       stabilize_call (t, initp);
+     }
+ }
+ 
  
  #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
  /* Complain that some language-specific thing hanging off a tree
*** ./gcc/cp/typeck.c.~1~	2004-03-01 16:03:09.000000000 -0500
--- ./gcc/cp/typeck.c	2004-03-01 16:23:13.000000000 -0500
*************** build_modify_expr (tree lhs, enum tree_c
*** 5016,5022 ****
  	  return cond;
  	/* Make sure the code to compute the rhs comes out
  	   before the split.  */
! 	return build (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond);
        }
        
      default:
--- 5016,5024 ----
  	  return cond;
  	/* Make sure the code to compute the rhs comes out
  	   before the split.  */
! 	if (preeval)
! 	  cond = build (COMPOUND_EXPR, TREE_TYPE (lhs), preeval, cond);
! 	return cond;
        }
        
      default:
*** ./gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C.~1~	2003-04-30 22:02:39.000000000 -0400
--- ./gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C	2004-03-01 16:23:13.000000000 -0500
***************
*** 1,4 ****
! // { dg-do assemble  }
! // { dg-options "" }
  
! int *foo = new int[1](0); // { dg-bogus "" } 
--- 1,8 ----
! // { dg-do run { xfail *-*-* } }
! // { dg-options "-w -fpermissive" }
  
! int *foo = new int[1](42); // { dg-bogus "" }
! int main ()
! {
!   return foo[0] != 42;
! }
*** ./gcc/testsuite/g++.old-deja/g++.martin/new1.C.~1~	2003-04-30 22:02:44.000000000 -0400
--- ./gcc/testsuite/g++.old-deja/g++.martin/new1.C	2004-03-01 16:23:13.000000000 -0500
*************** void test1()
*** 71,78 ****
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(new_done==1);
!   CHECK(ctor_done==2);
    CHECK(func_done==3);
    CHECK(dtor_done==4);
    CHECK(delete_done==0);
--- 71,78 ----
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(ctor_done==1);
!   CHECK(new_done==2);
    CHECK(func_done==3);
    CHECK(dtor_done==4);
    CHECK(delete_done==0);
*************** void test2()
*** 86,95 ****
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(new_done==1);
!   CHECK(ctor_done==0);
    CHECK(func_done==0);
!   CHECK(dtor_done==0);
    CHECK(delete_done==0);
  }
  
--- 86,95 ----
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(ctor_done==1);
!   CHECK(new_done==2);
    CHECK(func_done==0);
!   CHECK(dtor_done==3);
    CHECK(delete_done==0);
  }
  
*************** void test3()
*** 101,111 ****
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(new_done==1);
!   CHECK(ctor_done==2);
    CHECK(func_done==0);
    CHECK(dtor_done==0);
!   CHECK(delete_done==3);
  }
  
  int main()
--- 101,111 ----
      func(new B(A(10).addr()));
    }catch(int){
    }
!   CHECK(new_done==0);
!   CHECK(ctor_done==1);
    CHECK(func_done==0);
    CHECK(dtor_done==0);
!   CHECK(delete_done==0);
  }
  
  int main()
*** ./gcc/testsuite/g++.old-deja/g++.robertl/eb58.C.~1~	2003-04-30 22:02:58.000000000 -0400
--- ./gcc/testsuite/g++.old-deja/g++.robertl/eb58.C	2004-03-01 16:23:13.000000000 -0500
***************
*** 1,5 ****
  // { dg-do run  }
! // { dg-options "" }
  // Test for g++ array init extension 
  
  class A {
--- 1,5 ----
  // { dg-do run  }
! // { dg-options "-w -fpermissive" }
  // Test for g++ array init extension 
  
  class A {
*** ./gcc/testsuite/g++.old-deja/g++.robertl/eb63.C.~1~	2003-04-30 22:02:58.000000000 -0400
--- ./gcc/testsuite/g++.old-deja/g++.robertl/eb63.C	2004-03-01 16:23:13.000000000 -0500
***************
*** 1,5 ****
  // { dg-do run  }
! // { dg-options "" }
  //This uses GNU extensions, so disable -ansi
  #include <stdio.h>
  #include <stdlib.h>
--- 1,5 ----
  // { dg-do run  }
! // { dg-options "-w -fpermissive" }
  //This uses GNU extensions, so disable -ansi
  #include <stdio.h>
  #include <stdlib.h>

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