Fix SJLJ exceptions

Jan Hubicka hubicka@ucw.cz
Sun Apr 5 18:28:00 GMT 2009


Hi,
this patch fix the segfault I introduced by ehclanup at sjlj exceptions.
I apologize the problem and will mind testing all the other EH patches
with --enable-sjlj too.

I've tested this on i686-linux that reproduce the problem, re-testing
x86_64-linux and will commit it as obvious.

	* except.c (sjlj_find_directly_reachable_regions): Be ready for removed toplevel
	regions.
	(sjlj_mark_call_sites): Likewise.
Index: except.c
===================================================================
*** except.c	(revision 145564)
--- except.c	(working copy)
*************** sjlj_find_directly_reachable_regions (st
*** 1930,1935 ****
--- 1930,1937 ----
  	continue;
  
        region = VEC_index (eh_region, cfun->eh->region_array, INTVAL (XEXP (note, 0)));
+       if (!region)
+ 	continue;
  
        type_thrown = NULL_TREE;
        if (region->type == ERT_THROW)
*************** sjlj_mark_call_sites (struct sjlj_lp_inf
*** 2040,2046 ****
  	continue;
  
        note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
!       if (!note)
  	{
  	  /* Calls (and trapping insns) without notes are outside any
  	     exception handling region in this function.  Mark them as
--- 2042,2058 ----
  	continue;
  
        note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
! 
!       /* Calls that are known to not throw need not be marked.  */
!       if (note && INTVAL (XEXP (note, 0)) <= 0)
! 	continue;
! 
!       if (note)
! 	region = VEC_index (eh_region, cfun->eh->region_array, INTVAL (XEXP (note, 0)));
!       else
!         region = NULL;
! 
!       if (!region)
  	{
  	  /* Calls (and trapping insns) without notes are outside any
  	     exception handling region in this function.  Mark them as
*************** sjlj_mark_call_sites (struct sjlj_lp_inf
*** 2053,2066 ****
  	    continue;
  	}
        else
! 	{
! 	  /* Calls that are known to not throw need not be marked.  */
! 	  if (INTVAL (XEXP (note, 0)) <= 0)
! 	    continue;
! 
! 	  region = VEC_index (eh_region, cfun->eh->region_array, INTVAL (XEXP (note, 0)));
! 	  this_call_site = lp_info[region->region_number].call_site_index;
! 	}
  
        if (this_call_site == last_call_site)
  	continue;
--- 2065,2071 ----
  	    continue;
  	}
        else
! 	this_call_site = lp_info[region->region_number].call_site_index;
  
        if (this_call_site == last_call_site)
  	continue;



More information about the Gcc-patches mailing list