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]

Fix label duplication code


Hi,
there is apparently typo in tree-inline.c where remap_decl is called but
it's result ignored.  This means that label_decls get shared across
copies of functions created by versioning Razya is about to send that
causes DECL_UID to be set when they are still expected to be clear.

It would seem that proper fix is to make LABEL_DECLs copied, but this
breaks when nested fucntion referncing labels of outer function is used.
The patch solves problem Razya is seeing with versioning and avoids
duplication for nested functions. 

Does this seem to make sense?  Bootstrapped/regtested i686-pc-gnu-linux
Honza

2005-06-16  Jan Hubicka  <jh@suse.cz>
	* tree-inline.c (copy_body_r): Fix code duplicating LABEL_DECL.
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.193
diff -c -3 -p -r1.193 tree-inline.c
*** tree-inline.c	9 Jun 2005 16:21:36 -0000	1.193
--- tree-inline.c	15 Jun 2005 23:58:46 -0000
*************** copy_body_r (tree *tp, int *walk_subtree
*** 554,562 ****
      copy_statement_list (tp);
    else if (TREE_CODE (*tp) == SAVE_EXPR)
      remap_save_expr (tp, id->decl_map, walk_subtrees);
!   else if (TREE_CODE (*tp) == LABEL_DECL)
      /* These may need to be remapped for EH handling.  */
!     remap_decl (*tp, id);
    else if (TREE_CODE (*tp) == BIND_EXPR)
      copy_bind_expr (tp, walk_subtrees, id);
    /* Types may need remapping as well.  */
--- 554,563 ----
      copy_statement_list (tp);
    else if (TREE_CODE (*tp) == SAVE_EXPR)
      remap_save_expr (tp, id->decl_map, walk_subtrees);
!   else if (TREE_CODE (*tp) == LABEL_DECL
! 	   && decl_function_context (*tp) == id->callee)
      /* These may need to be remapped for EH handling.  */
!     *tp = remap_decl (*tp, id);
    else if (TREE_CODE (*tp) == BIND_EXPR)
      copy_bind_expr (tp, walk_subtrees, id);
    /* Types may need remapping as well.  */


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