From 77baee3f79c91561a56b3ef9a498f6a949b62153 Mon Sep 17 00:00:00 2001
From: tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 20 Feb 2002 03:16:30 +0000
Subject: [PATCH] 	Fix for PR libgcj/5696: 	* verify.cc
 (is_assignable_from_slow): Never call 	_Jv_IsAssignableFrom. 
 (verify_instructions_0): Added new debug statement. 	(state::print): Print
 information about whether local has 	changed. 	(state::merge): Don't
 call note_variable when merging locals. 	(state::set_exception):
 Removed old FIXME comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49886 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libjava/ChangeLog | 11 +++++++++++
 libjava/verify.cc | 24 ++++++++++++------------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index a0770ba1ce9e..447ccfb5c31e 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,14 @@
+2002-02-19  Tom Tromey  <tromey@redhat.com>
+
+	Fix for PR libgcj/5696:
+	* verify.cc (is_assignable_from_slow): Never call
+	_Jv_IsAssignableFrom.
+	(verify_instructions_0): Added new debug statement.
+	(state::print): Print information about whether local has
+	changed.
+	(state::merge): Don't call note_variable when merging locals.
+	(state::set_exception): Removed old FIXME comment.
+
 2002-02-18  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
 	* java/net/natPlainDatagramSocketImpl.cc (bind): Call setsockopt to
diff --git a/libjava/verify.cc b/libjava/verify.cc
index cbadd9f2f2f9..36dbcccb8d4f 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -231,9 +231,6 @@ private:
 	if (target->isPrimitive () || source->isPrimitive ())
 	  return false;
 
-	// Check array case first because we can have an array whose
-	// component type is not prepared; _Jv_IsAssignableFrom
-	// doesn't handle this correctly.
 	if (target->isArray ())
 	  {
 	    if (! source->isArray ())
@@ -241,11 +238,6 @@ private:
 	    target = target->getComponentType ();
 	    source = source->getComponentType ();
 	  }
-	// _Jv_IsAssignableFrom can handle a target which is an
-	// interface even if it hasn't been prepared.
-	else if ((target->state > JV_STATE_LINKED || target->isInterface ())
-		 && source->state > JV_STATE_LINKED)
-	  return _Jv_IsAssignableFrom (target, source);
 	else if (target->isInterface ())
 	  {
 	    for (int i = 0; i < source->interface_count; ++i)
@@ -912,8 +904,6 @@ private:
       stack[0] = t;
       for (int i = stacktop; i < max_stack; ++i)
 	stack[i] = unsuitable_type;
-
-      // FIXME: subroutine handling?
     }
 
     // Modify this state to reflect entry into a subroutine.
@@ -982,8 +972,14 @@ private:
 	    {
 	      if (locals[i].merge (state_old->locals[i], true, verifier))
 		{
+		  // Note that we don't call `note_variable' here.
+		  // This change doesn't represent a real change to a
+		  // local, but rather a merge artifact.  If we're in
+		  // a subroutine which is called with two
+		  // incompatible types in a slot that is unused by
+		  // the subroutine, then we don't want to mark that
+		  // variable as having been modified.
 		  changed = true;
-		  note_variable (i);
 		}
 	    }
 
@@ -1072,7 +1068,10 @@ private:
 	debug_print (".");
       debug_print ("    [local] ");
       for (i = 0; i < max_locals; ++i)
-	locals[i].print ();
+	{
+	  locals[i].print ();
+	  debug_print (local_changed[i] ? "+" : " ");
+	}
       if (subroutine == 0)
 	debug_print ("   | None");
       else
@@ -2055,6 +2054,7 @@ private:
 	      verify_fail ("can't happen: saw state::INVALID");
 	    if (PC == state::NO_NEXT)
 	      break;
+	    debug_print ("== State pop from pending list\n");
 	    // Set up the current state.
 	    current_state->copy (states[PC], current_method->max_stack,
 				 current_method->max_locals);
-- 
GitLab