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]

Re: [C++ PATCH] Avoid sharing DECL_UID between different decls (was Re: checked in patch for PR 27793)


On Tue, 2006-06-13 at 02:34 -0400, Jakub Jelinek wrote:
> On Fri, Jun 09, 2006 at 04:02:59PM -0400, Andrew MacLeod wrote:
> > On Fri, 2006-06-09 at 15:05 -0400, Jakub Jelinek wrote:
> > > On Wed, Jun 07, 2006 at 09:20:25PM -0400, Andrew MacLeod wrote:
> >
> Yes, but your assert.diff is gcc-4_1-branch patch and the trunk is very
> different, so I'd prefer if you could handle that part yourself.

OK, here's the reverted patch with the assert appropriately added.

Checked in on mainline.  Bootstrapped and no new regressions on
i686-pc-linux-gnu. Also verified that the assert triggers when Jakub's
patch is reverted.

Andrew



2006-06-15  Andrew MacLeod  <amacleod@redhat.com>
	
	PR middle-end/27793
	* tree-dfa.c (referenced_vars_dup_list): Remove.
	(find_referenced_vars): Remove assert.
	(referenced_var_check_and_insert): Replace dup list with assert.
	* tree-ssa.c (delete_tree_ssa): Remove dup list processing.
	* tree-flow.h (referenced_vars_dup_list): Remove extern decl.

Index: tree-dfa.c
===================================================================
*** tree-dfa.c	(revision 114677)
--- tree-dfa.c	(working copy)
*************** static tree find_vars_r (tree *, int *, 
*** 75,82 ****
  
  /* Array of all variables referenced in the function.  */
  htab_t referenced_vars;
- /* List of referenced variables with duplicate UID's.  */
- VEC(tree,gc) *referenced_vars_dup_list;
  
  /* Default definition for this symbols.  If set for symbol, it
     means that the first reference to this variable in the function is a
--- 75,80 ----
*************** find_referenced_vars (void)
*** 102,108 ****
    basic_block bb;
    block_stmt_iterator si;
  
-   gcc_assert (VEC_length (tree, referenced_vars_dup_list) == 0);
    FOR_EACH_BB (bb)
      for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
        {
--- 100,105 ----
*************** referenced_var_check_and_insert (tree to
*** 640,666 ****
  
    if (h)
      {
-       unsigned u;
-       tree t = NULL_TREE;
- 
        /* DECL_UID has already been entered in the table.  Verify that it is
! 	 the same entry as TO.  */
!       gcc_assert (h->to != NULL);
!       if (h->to == to)
!         return false;
! 
!       /* PRs 26757 and 27793.  Maintain a list of duplicate variable pointers
! 	 with the same DECL_UID.  There isn't usually very many.
! 	 TODO.  Once the C++ front end doesn't create duplicate DECL UID's, this
! 	 code can be removed.  */
!       for (u = 0; u < VEC_length (tree, referenced_vars_dup_list); u++)
! 	{
! 	  t = VEC_index (tree, referenced_vars_dup_list, u);
! 	  if (t == to)
! 	    break;
! 	}
!       if (t != to)
! 	VEC_safe_push (tree, gc, referenced_vars_dup_list, to);
        return false;
      }
  
--- 637,645 ----
  
    if (h)
      {
        /* DECL_UID has already been entered in the table.  Verify that it is
! 	 the same entry as TO.  See PR 27793.  */
!       gcc_assert (h->to == to);
        return false;
      }
  
Index: tree-ssa.c
===================================================================
*** tree-ssa.c	(revision 114677)
--- tree-ssa.c	(working copy)
*************** delete_tree_ssa (void)
*** 853,859 ****
    block_stmt_iterator bsi;
    referenced_var_iterator rvi;
    tree var;
-   unsigned u;
  
    /* Release any ssa_names still in use.  */
    for (i = 0; i < num_ssa_names; i++)
--- 853,858 ----
*************** delete_tree_ssa (void)
*** 888,903 ****
        ggc_free (var->common.ann);
        var->common.ann = NULL;
      }
- 
-   /* Remove any referenced variables which had duplicate UID's.  */
-   for (u = 0; u < VEC_length (tree, referenced_vars_dup_list); u++)
-     {
-       var = VEC_index (tree, referenced_vars_dup_list, u);
-       ggc_free (var->common.ann);
-       var->common.ann = NULL;
-     }
-   VEC_free (tree, gc, referenced_vars_dup_list);
- 
    htab_delete (referenced_vars);
    referenced_vars = NULL;
  
--- 887,892 ----
Index: tree-flow.h
===================================================================
*** tree-flow.h	(revision 114677)
--- tree-flow.h	(working copy)
*************** typedef struct
*** 419,426 ****
  
  /* Array of all variables referenced in the function.  */
  extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
- /* List of referenced variables in the function with duplicate UID's.  */
- extern VEC(tree,gc) *referenced_vars_dup_list;
  
  /* Default defs for undefined symbols. */
  extern GTY((param_is (struct int_tree_map))) htab_t default_defs;
--- 419,424 ----

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