This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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);
 		}

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