optabs.c patch for ia64-linux java segfault

Jim Wilson wilson@redhat.com
Mon Oct 1 19:05:00 GMT 2001


This java testcase gets a segfault when compiled at -O2 on ia64-linux.
I have checked in the following patch to fix this.  Java uses
-fnon-call-exceptions, which causes a divide libcall to get a REG_EH_REGION
note, which causes the divide libcall to span two basic blocks.  libcalls
can't span two basic blocks, so we can't use a libcall sequence in that
case, it has to be an ordinary call sequence.

public class divtest {
    private long min_transaction_count = Long.MAX_VALUE;
    private long max_transaction_count = Long.MIN_VALUE;
    public void set(long z) { min_transaction_count = z; }
    public synchronized void displayThreadResults()
    {

        // long diff = max_transaction_count - min_transaction_count; 
	float diff_pct = (float)max_transaction_count / (float)min_transaction_count;

    }
}

2001-10-01  Hans Boehm  <boehm@acm.org>

	* optabs.c (emit_libcall_block): When using non-call exceptions,
	don't add REG_LIBCALL reg notes to trapping calls.

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.112
diff -p -r1.112 optabs.c
*** optabs.c	2001/09/26 20:02:51	1.112
--- optabs.c	2001/10/02 01:57:38
*************** emit_libcall_block (insns, target, resul
*** 2957,2965 ****
      first = NEXT_INSN (prev);
  
    /* Encapsulate the block so it gets manipulated as a unit.  */
!   REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
! 					 REG_NOTES (first));
!   REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first, REG_NOTES (last));
  }
  
  /* Generate code to store zero in X.  */
--- 2957,2969 ----
      first = NEXT_INSN (prev);
  
    /* Encapsulate the block so it gets manipulated as a unit.  */
!   if (!flag_non_call_exceptions || !may_trap_p (equiv))
!     {
!       REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
! 		      			     REG_NOTES (first));
!       REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first,
! 		      			    REG_NOTES (last));
!     }
  }
  
  /* Generate code to store zero in X.  */



More information about the Gcc-patches mailing list