This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[committed] Fix PR libgcj/23507
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: java-patches at gcc dot gnu dot org
- Date: Sun, 21 Aug 2005 19:47:29 -0400 (EDT)
- Subject: [committed] Fix PR libgcj/23507
The enclosed patch fixes two bugs in _Jv_StackTrace::UnwindTraceFn.
The first is a typo which causes memcpy to segfault. The second
is that we need to compare func_addr and &_Jv_InterpMethod::run as
function pointers on hppa-unknown-linux-gnu as unfortunately function
descriptors are not always unique. As a result, the interpreter
frame check was failing.
Tested on hppa-unknown-linux-gnu.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2005-08-21 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR libgcj/23507
* stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Fix typo in newLength
assignment. Cast operands of compare to function pointer type.
Index: stacktrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/stacktrace.cc,v
retrieving revision 1.8
diff -u -3 -p -r1.8 stacktrace.cc
--- stacktrace.cc 25 May 2005 23:24:05 -0000 1.8
+++ stacktrace.cc 21 Aug 2005 20:34:58 -0000
@@ -102,7 +102,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
// Check if the trace buffer needs to be extended.
if (pos == state->length)
{
- int newLength = state->length *= 2;
+ int newLength = state->length * 2;
void *newFrames = _Jv_AllocBytes (newLength * sizeof(_Jv_StackFrame));
memcpy (newFrames, state->frames, state->length * sizeof(_Jv_StackFrame));
state->frames = (_Jv_StackFrame *) newFrames;
@@ -117,7 +117,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
// correspondance between call frames in the interpreted stack and occurances
// of _Jv_InterpMethod::run() on the native stack.
#ifdef INTERPRETER
- if (func_addr == (_Unwind_Ptr) &_Jv_InterpMethod::run)
+ if ((void (*)(void)) func_addr == (void (*)(void)) &_Jv_InterpMethod::run)
{
state->frames[pos].type = frame_interpreter;
state->frames[pos].interp.meth = state->interp_frame->self;