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]

GCC 2.95.2 and -fsjlj-exceptions fix for bugs #258 ans #413


Attached please find patch which fixes bugs #258 and #413 from GCC GNATS
database. Both bug report originators have been contacted and confirmed that
the patch indeed fixes the problem they have reported.

Could someone please review the patch and either suggest better
alternative or commit it to the GCC 2.95 branch. Having the fix on GCC 2.95
branch will allow FreeBSD and presumably OpenBSD to import it relatively easily.

----------------------------------
E-Mail: Alexander N. Kabaev <ak03@gte.com>
Date: 05-Sep-00
Time: 16:35:19
----------------------------------
Index: emit-rtl.c
===================================================================
RCS file: /home/ncvs/src/contrib/gcc.295/emit-rtl.c,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 emit-rtl.c
*** emit-rtl.c	1999/10/16 06:03:55	1.1.1.3
--- emit-rtl.c	2000/09/04 04:05:20
*************** gen_inline_header_rtx (first_insn, first
*** 1651,1657 ****
  		       pops_args, stack_slots, forced_labels, function_flags,
  		       outgoing_args_size, original_arg_vector,
  		       original_decl_initial, regno_rtx, regno_flag,
! 		       regno_align, parm_reg_stack_loc)
       rtx first_insn, first_parm_insn;
       int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size;
       int pops_args;
--- 1651,1658 ----
  		       pops_args, stack_slots, forced_labels, function_flags,
  		       outgoing_args_size, original_arg_vector,
  		       original_decl_initial, regno_rtx, regno_flag,
! 		       regno_align, parm_reg_stack_loc,
! 		       nonlocal_goto_handler_labels)
       rtx first_insn, first_parm_insn;
       int first_labelno, last_labelno, max_parm_regnum, max_regnum, args_size;
       int pops_args;
*************** gen_inline_header_rtx (first_insn, first
*** 1665,1670 ****
--- 1666,1672 ----
       char *regno_flag;
       char *regno_align;
       rtvec parm_reg_stack_loc;
+      rtx nonlocal_goto_handler_labels;
  {
    rtx header = gen_rtx_INLINE_HEADER (VOIDmode,
  				      cur_insn_uid++, NULL_RTX,
*************** gen_inline_header_rtx (first_insn, first
*** 1676,1682 ****
  				      original_arg_vector,
  				      original_decl_initial,
  				      regno_rtx, regno_flag, regno_align,
! 				      parm_reg_stack_loc);
    return header;
  }
  
--- 1678,1686 ----
  				      original_arg_vector,
  				      original_decl_initial,
  				      regno_rtx, regno_flag, regno_align,
! 				      parm_reg_stack_loc,
! 				      nonlocal_goto_handler_labels,
! 				      nonlocal_goto_handler_labels);
    return header;
  }
  
Index: integrate.c
===================================================================
RCS file: /home/ncvs/src/contrib/gcc.295/integrate.c,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 integrate.c
*** integrate.c	1999/10/16 06:05:22	1.1.1.3
--- integrate.c	2000/09/04 04:26:44
*************** function_cannot_inline_p (fndecl)
*** 151,156 ****
--- 151,160 ----
    if (current_function_contains_functions)
      return N_("function with nested functions cannot be inline");
  
+   if (forced_labels)
+     return
+       N_("function with label addresses used in initializers cannot inline");
+ 
    if (current_function_cannot_inline)
      return current_function_cannot_inline;
  
*************** initialize_for_inline (fndecl, min_label
*** 425,431 ****
  				arg_vector, (rtx) DECL_INITIAL (fndecl),
  				(rtvec) regno_reg_rtx, regno_pointer_flag,
  				regno_pointer_align,
! 				(rtvec) parm_reg_stack_loc);
  }
  
  /* Subroutine for `save_for_inline{copying,nocopy}'.  Finishes up the
--- 429,436 ----
  				arg_vector, (rtx) DECL_INITIAL (fndecl),
  				(rtvec) regno_reg_rtx, regno_pointer_flag,
  				regno_pointer_align,
! 				(rtvec) parm_reg_stack_loc,
! 				nonlocal_goto_handler_labels);
  }
  
  /* Subroutine for `save_for_inline{copying,nocopy}'.  Finishes up the
*************** save_for_inline_copying (fndecl)
*** 746,751 ****
--- 751,765 ----
        REG_NOTES (insn_map[INSN_UID (insn)])
  	= copy_for_inline (REG_NOTES (insn));
  
+   /* Now adjust nonlocal_goto_handler_labels list */
+   copy = NULL_RTX;
+   for (insn = nonlocal_goto_handler_labels; insn ; insn = XEXP (insn, 1))
+      if (label_map[CODE_LABEL_NUMBER (XEXP (insn,0))] != NULL_RTX)  
+ 	copy = gen_rtx_EXPR_LIST (VOIDmode,
+ 		label_map[CODE_LABEL_NUMBER (XEXP (insn,0))],
+ 		copy);
+   NONLOCAL_GOTO_LABELS_TRAN(head) = copy;
+ 
    NEXT_INSN (last_insn) = NULL;
  
    finish_inline (fndecl, head);
*************** expand_inline_function (fndecl, parms, t
*** 2130,2135 ****
--- 2144,2157 ----
  	REG_NOTES (map->insn_map[INSN_UID (insn)]) = tem;
        }
  
+   /* Now copy nonlocal_goto_handler_list from the function being
+      inlined into the current list. */
+   for (insn = NONLOCAL_GOTO_LABELS_TRAN(header); insn ; insn = XEXP (insn, 1))
+      if ( map->label_map[CODE_LABEL_NUMBER (XEXP (insn,0))] != NULL_RTX)
+ 	nonlocal_goto_handler_labels  = gen_rtx_EXPR_LIST (VOIDmode,
+ 		map->label_map[CODE_LABEL_NUMBER (XEXP (insn,0))],   
+ 		nonlocal_goto_handler_labels);
+ 
    if (local_return_label)
      emit_label (local_return_label);
  
*************** output_inline_function (fndecl)
*** 3402,3410 ****
    regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (head);
    max_parm_reg = MAX_PARMREG (head);
    parm_reg_stack_loc = (rtx *) PARMREG_STACK_LOC (head);
!   
    stack_slot_list = STACK_SLOT_LIST (head);
    forced_labels = FORCED_LABELS (head);
  
    if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_HAS_COMPUTED_JUMP)
      current_function_has_computed_jump = 1;
--- 3424,3433 ----
    regno_pointer_align = INLINE_REGNO_POINTER_ALIGN (head);
    max_parm_reg = MAX_PARMREG (head);
    parm_reg_stack_loc = (rtx *) PARMREG_STACK_LOC (head);
!  
    stack_slot_list = STACK_SLOT_LIST (head);
    forced_labels = FORCED_LABELS (head);
+   nonlocal_goto_handler_labels = NONLOCAL_GOTO_LABELS (head);
  
    if (FUNCTION_FLAGS (head) & FUNCTION_FLAGS_HAS_COMPUTED_JUMP)
      current_function_has_computed_jump = 1;
Index: rtl.def
===================================================================
RCS file: /home/ncvs/src/contrib/gcc.295/rtl.def,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 rtl.def
*** rtl.def	1999/10/16 06:05:45	1.1.1.3
--- rtl.def	2000/09/04 04:01:50
*************** DEF_RTL_EXPR(NOTE, "note", "iuusn", 'x')
*** 396,402 ****
     it contains helps to build the mapping function between the rtx's of
     the function to be inlined and the current function being expanded.  */
  
! DEF_RTL_EXPR(INLINE_HEADER, "inline_header", "iuuuiiiiiieeiiEeEssE", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
--- 396,402 ----
     it contains helps to build the mapping function between the rtx's of
     the function to be inlined and the current function being expanded.  */
  
! DEF_RTL_EXPR(INLINE_HEADER, "inline_header", "iuuuiiiiiieeiiEeEssEee", 'x')
  
  /* ----------------------------------------------------------------------
     Top level constituents of INSN, JUMP_INSN and CALL_INSN.
Index: rtl.h
===================================================================
RCS file: /home/ncvs/src/contrib/gcc.295/rtl.h,v
retrieving revision 1.1.1.3
diff -c -3 -p -r1.1.1.3 rtl.h
*** rtl.h	1999/10/16 06:05:45	1.1.1.3
--- rtl.h	2000/09/04 04:00:05
*************** extern char *note_insn_name[];
*** 704,709 ****
--- 704,711 ----
  #define INLINE_REGNO_POINTER_FLAG(RTX) ((RTX)->fld[17].rtstr)
  #define INLINE_REGNO_POINTER_ALIGN(RTX) ((RTX)->fld[18].rtstr)
  #define PARMREG_STACK_LOC(RTX) ((RTX)->fld[19].rtvec)
+ #define NONLOCAL_GOTO_LABELS(RTX) ((RTX)->fld[20].rtx)
+ #define NONLOCAL_GOTO_LABELS_TRAN(RTX) ((RTX)->fld[21].rtx)
  
  /* In FUNCTION_FLAGS we save some variables computed when emitting the code
     for the function and which must be `or'ed into the current flag values when
*************** extern rtx gen_label_rtx		PROTO((void));
*** 936,942 ****
  extern rtx gen_inline_header_rtx	PROTO((rtx, rtx, int, int, int, int,
  					       int, int, rtx, rtx, int, int,
  					       rtvec, rtx,
! 					       rtvec, char *, char *, rtvec));
  extern rtx gen_lowpart_common		PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart			PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart_if_possible	PROTO((enum machine_mode, rtx));
--- 938,945 ----
  extern rtx gen_inline_header_rtx	PROTO((rtx, rtx, int, int, int, int,
  					       int, int, rtx, rtx, int, int,
  					       rtvec, rtx,
! 					       rtvec, char *, char *, rtvec,
! 					       rtx));
  extern rtx gen_lowpart_common		PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart			PROTO((enum machine_mode, rtx));
  extern rtx gen_lowpart_if_possible	PROTO((enum machine_mode, rtx));

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