public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libgcj/5695: verify.cc test that target is an object before running down interfaces
@ 2002-02-14 23:01 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2002-02-14 23:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, toddastock, tromey

Synopsis: verify.cc test that target is an object before running down interfaces

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Thu Feb 14 23:00:56 2002
Responsible-Changed-Why:
    I'm handling this.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Thu Feb 14 23:00:56 2002
State-Changed-Why:
    I've checked in a fix.  I used a slightly different
    patch as I had already written it.
    Thanks for the report.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5695


^ permalink raw reply	[flat|nested] 2+ messages in thread

* libgcj/5695: verify.cc test that target is an object before running down interfaces
@ 2002-02-14 18:26 toddastock
  0 siblings, 0 replies; 2+ messages in thread
From: toddastock @ 2002-02-14 18:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5695
>Category:       libgcj
>Synopsis:       verify.cc test that target is an object before running down interfaces
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 14 18:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1 20020214 (experimental)
>Organization:
>Environment:
System: Linux escher 2.4.9-21 #1 Thu Jan 17 14:16:30 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --enable-threads=posix --prefix=/home/tstock/local --disable-shared --enable-languages=c++,java
>Description:
verify.cc test that target is an object before running down interfaces.  Based on the prior bug (5670)
>How-To-Repeat:
import java.io.*;
import java.util.*;

public class Test2
  {
  Vector v = new Vector( );
  public void addBuildListener( TestListener l )
    {
      v.addElement( l );
    }
  }
import java.io.*;
import java.util.*;

public class Test
  {
  Object x = null;
  int y = 0;

  public static void main (String[] args)
    {

      Test t = new Test( );
      try
        {
          t.doit( );
        }
      catch( Exception e )
        {
        }
    }

  private void doit( ) throws Exception
    {
      final Test2 t = new Test2();
      addListener(t);
    }

  protected void addListener( Test2 t )
    {
      t.addBuildListener(doitSub());
    }

  private TestLogger testE () throws IOException
    {
      return new TestLoggerDefault();
    }

  private TestLogger doitSub ()
    {
      TestLogger logger = null;
      if( x != null )
        {
          try
          {
            logger = testE();
          }
          catch( IOException e )
          {
            throw new RuntimeException( );
          }
          catch( Exception e )
          {
            throw new RuntimeException( );
          }
        }
      else
        {
          logger = new TestLoggerDefault( );
        }
  
      logger.print(y);
      return logger;
    }
  }
public interface TestListener
  {
  }
public class TestLoggerDefault implements TestLogger
  {

  public void print ( int y )
    {
    }

  }
public interface TestLogger extends TestListener
  {
  void print ( int y );
  }
>Fix:
Reorder to check if target is an Object prior to running down the sources interface chain.
Index: verify.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/verify.cc,v
retrieving revision 1.37
diff -u -r1.37 verify.cc
--- verify.cc	14 Feb 2002 17:48:36 -0000	1.37
+++ verify.cc	15 Feb 2002 02:16:54 -0000
@@ -245,7 +245,13 @@
 	// 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 == &java::lang::Object::class$)
+	  {
+	  return true;
+          }
 	else if (target->isInterface ())
 	  {
 	    for (int i = 0; i < source->interface_count; ++i)
@@ -272,10 +278,10 @@
 	    if (target == NULL)
 	      return false;
 	  }
-	else if (target == &java::lang::Object::class$)
-	  return true;
 	else if (source == &java::lang::Object::class$)
+	  {
 	  return false;
+	  }
 	else
 	  source = source->getSuperclass ();
       }
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-15  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-14 23:01 libgcj/5695: verify.cc test that target is an object before running down interfaces tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-02-14 18:26 toddastock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).