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]

Re: C++ patch for tree inlining bug with dynamic arrays



  Index: optimize.c
  ===================================================================
  RCS file: /cvs/cvsfiles/devo/gcc/cp/optimize.c,v
  retrieving revision 1.2
  diff -p -r1.2 optimize.c
  *** optimize.c	2000/01/03 19:18:42	1.2
  --- optimize.c	2000/01/26 03:26:03
  *************** remap_decl (decl, id)
  *** 104,109 ****
  --- 104,118 ----
	  /* Make a copy of the variable or label.  */
	  t = copy_decl_for_inlining (decl, fn, 
				    VARRAY_TREE (id->fns, 0));
  + 
  +       /* The decl T could be a dynamic array or other variable size type,
  + 	 in which case some fields need to be remapped because they may
  + 	 contain SAVE_EXPRs.  */
  +       walk_tree (&DECL_SIZE (t), copy_body_r, id);
  +       if (TREE_TYPE (t) && TYPE_DOMAIN (TREE_TYPE (t)))
  + 	walk_tree (&TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))),
  + 		   copy_body_r, id);
  + 
	  /* Remember it, so that if we encounter this local entity
	   again we can reuse this copy.  */
	  n = splay_tree_insert (id->decl_map, 

Thanks!  This looks fine to me, assuming it passes the regression
tests, and I don't see any reason why it wouldn't.

I think you should check TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE as
well before checking TYPE_DOMAIN.  There might be other types (perhaps
not even as-of-yet defined) for which the TYPE_DOMAIN was not a thing
for which TYPE_MAX_VALUE makes sense.

Thanks,

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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