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 to build_vec_init for c++/12253


We were failing to destroy temporaries after initializing an array element
from an initializer list.  This is a semantic bug on the trunk (and at
least back to 2.95), as well as causing a crash on the tree-ssa branch.

Tested on x86_64-pc-linux-gnu, applied to trunk and tree-ssa.  Gaby, shall
I apply this to the 3.3 branch as well?

2003-12-18  Jason Merrill  <jason@redhat.com>

	PR c++/12253
	* init.c (build_vec_init): Initialization of an element from
	an initializer list is also a full-expression.

*** init.c.~1~	2003-12-18 11:41:18.000000000 -0500
--- init.c	2003-12-18 13:43:11.000000000 -0500
*************** build_vec_init (tree base, tree maxindex
*** 2603,2613 ****
--- 2603,2615 ----
  
  	  num_initialized_elts++;
  
+ 	  current_stmt_tree ()->stmts_are_full_exprs_p = 1;
  	  if (IS_AGGR_TYPE (type) || TREE_CODE (type) == ARRAY_TYPE)
  	    finish_expr_stmt (build_aggr_init (baseref, elt, 0));
  	  else
  	    finish_expr_stmt (build_modify_expr (baseref, NOP_EXPR,
  						 elt));
+ 	  current_stmt_tree ()->stmts_are_full_exprs_p = 0;
  
  	  finish_expr_stmt (build_unary_op (PREINCREMENT_EXPR, base, 0));
  	  finish_expr_stmt (build_unary_op (PREDECREMENT_EXPR, iterator, 0));

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