This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
requested gcc-4.0/libjava patch
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org, mark at codesourcery dot com
- Date: Mon, 28 Mar 2005 00:15:56 -0800
- Subject: requested gcc-4.0/libjava patch
I checked this into mainline.
Tom Tromey says it should "definitely go in 4.0".
It seems quite safe - it just adds a null-pointer check.
Here is the analysis of the bug;
http://gcc.gnu.org/ml/java/2005-03/msg00141.html
Ok for the 4.0 branch?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2005-03-26 Per Bothner <per@bothner.com>
* boehm.cc (_Jv_MarkObj): Don't follow null pointer to static field,
which can happen if class is JV_STATE_LOADED but not JV_STATE_PREPARED.
Index: boehm.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v
retrieving revision 1.45
diff -u -p -r1.45 boehm.cc
--- boehm.cc 25 Nov 2004 03:46:53 -0000 1.45
+++ boehm.cc 25 Mar 2005 18:42:07 -0000
@@ -189,9 +189,11 @@ _Jv_MarkObj (void *addr, void *msp, void
// mark also the value pointed to. We check for isResolved
// since marking can happen before memory is allocated for
// static members.
- if (JvFieldIsRef (field) && field->isResolved())
+ // Note that field->u.addr may be null if the class c is
+ // JV_STATE_LOADED but not JV_STATE_PREPARED (initialized).
+ if (JvFieldIsRef (field) && p && field->isResolved())
{
- jobject val = *(jobject*) field->u.addr;
+ jobject val = *(jobject*) p;
p = (GC_PTR) val;
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c);
}