public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libgcj/5670: verify.cc not properly merging states
@ 2002-02-14  9:52 tromey
  0 siblings, 0 replies; 6+ messages in thread
From: tromey @ 2002-02-14  9:52 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, toddastock, tromey

Synopsis: verify.cc not properly merging states

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Thu Feb 14 09:52:16 2002
Responsible-Changed-Why:
    I'm handling this.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Thu Feb 14 09:52:16 2002
State-Changed-Why:
    I've checked in the patch.
    Thanks.
    I've also noticed another bug in this area which I 
    intend to fix soon.

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


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

* Re: libgcj/5670: verify.cc not properly merging states
@ 2002-02-14 17:56 Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2002-02-14 17:56 UTC (permalink / raw)
  To: tromey; +Cc: gcc-prs

The following reply was made to PR libgcj/5670; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: Todd Stock <toddastock@yahoo.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libgcj/5670: verify.cc not properly merging states
Date: 14 Feb 2002 19:14:07 -0700

 >>>>> "Todd" == Todd Stock <toddastock@yahoo.com> writes:
 
 Todd> As an extension to this I have another one.  Is the bug the same
 Todd> one you mention as finding and needing fixing?
 
 Nope, you found another one!
 I'm going to look into this problem soon too.
 I suspect the fix is to move the check for `target == Object'
 up a little.
 
 I also think I've found yet another bug :-(.
 In get_one_type(), we don't correctly return an array-of-reference type.
 We just return the base element reference type.
 I'll write a Mauve verifier test for this soon too.
 
 Tom


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

* Re: libgcj/5670: verify.cc not properly merging states
@ 2002-02-14 10:46 Todd Stock
  0 siblings, 0 replies; 6+ messages in thread
From: Todd Stock @ 2002-02-14 10:46 UTC (permalink / raw)
  To: tromey; +Cc: gcc-prs

The following reply was made to PR libgcj/5670; it has been noted by GNATS.

From: Todd Stock <toddastock@yahoo.com>
To: tromey@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libgcj/5670: verify.cc not properly merging states
Date: Thu, 14 Feb 2002 10:38:10 -0800

 As an extension to this I have another one.  Is the bug the same one you 
 mention as finding and needing fixing?
 
 I don't think this is the correct patch for the problem.  I am trying to 
 reproduce a third problem that also appears to show the same incomplete 
 type problem.
 
 -Todd
 
 The patch to fix this:
 
  +	else if (source->isInterface ())
  +	  {
  +	    for (int i = 0; i < target->interface_count; ++i)
  +	      {
  +		// We use a recursive call because we also need to
  +		// check superinterfaces.
  +		if (is_assignable_from_slow (target->interfaces[i], source))
  +		    return true;
  +	      }
  +	    target = target->getSuperclass ();
  +	    if (target == NULL)
  +	      return true;
 *^^^^^^^^^^^^^^^^^^^^^^^^^ return true instead of false.
  +	  }
 
 
 The code that produces the bug:
 
 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 );
   }
 
 
 
 
 _________________________________________________________
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 


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

* Re: libgcj/5670: verify.cc not properly merging states
@ 2002-02-12 11:06 Todd Stock
  0 siblings, 0 replies; 6+ messages in thread
From: Todd Stock @ 2002-02-12 11:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libgcj/5670; it has been noted by GNATS.

From: Todd Stock <toddastock@yahoo.com>
To: tromey@redhat.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libgcj/5670: verify.cc not properly merging states
Date: Tue, 12 Feb 2002 10:57:06 -0800

 Unidiffs for bugs 5669/5670/5671.
 
 Index: verify.cc
 ===================================================================
 RCS file: /cvsroot/gcc/gcc/libjava/verify.cc,v
 retrieving revision 1.35
 diff -u -r1.35 verify.cc
 --- verify.cc	7 Feb 2002 02:27:10 -0000	1.35
 +++ verify.cc	12 Feb 2002 18:50:09 -0000
 @@ -259,6 +259,19 @@
  	    if (source == NULL)
  	      return false;
  	  }
 +	else if (source->isInterface ())
 +	  {
 +	    for (int i = 0; i < target->interface_count; ++i)
 +	      {
 +		// We use a recursive call because we also need to
 +		// check superinterfaces.
 +		if (is_assignable_from_slow (target->interfaces[i], source))
 +		    return true;
 +	      }
 +	    target = target->getSuperclass ();
 +	    if (target == NULL)
 +	      return false;
 +	  }
  	else if (target == &java::lang::Object::class$)
  	  return true;
  	else if (source->isInterface ()
 @@ -676,7 +689,7 @@
  		    }
  
  		  // This loop will end when we hit Object.
 -		  while (true)
 +		  while (true && k!=NULL)
  		    {
  		      if (is_assignable_from_slow (k, oldk))
  			break;
 @@ -684,6 +697,12 @@
  		      changed = true;
  		    }
  
 +		  if( k == NULL )
 +		    {
 +		      *this = old_type;
 +		      changed = true;
 +		    }
 +		  else
  		  if (changed)
  		    {
  		      while (arraycount > 0)
 @@ -1943,9 +1962,11 @@
      return type (k);
    }
  
 -  void compute_argument_types (_Jv_Utf8Const *signature,
 -			       type *types)
 +  type *compute_argument_types (_Jv_Utf8Const *signature,
 +			       int arg_count)
    {
 +    if( arg_count == 0 ) return NULL;
 +    type *types=new type[arg_count];
      char *p = signature->data;
      // Skip `('.
      ++p;
 @@ -1953,6 +1974,7 @@
      int i = 0;
      while (*p != ')')
        types[i++] = get_one_type (p);
 +    return types;
    }
  
    type compute_return_type (_Jv_Utf8Const *signature)
 @@ -1994,8 +2016,7 @@
  
      // We have to handle wide arguments specially here.
      int arg_count = _Jv_count_arguments (current_method->self->signature);
 -    type arg_types[arg_count];
 -    compute_argument_types (current_method->self->signature, arg_types);
 +    type *arg_types = compute_argument_types( current_method->self->signature, arg_count );
      for (int i = 0; i < arg_count; ++i)
        {
  	set_variable (var, arg_types[i]);
 @@ -2004,6 +2025,8 @@
  	  ++var;
        }
  
 +    delete []arg_types;
 +
      return is_init;
    }
  
 @@ -2747,8 +2770,7 @@
  
  	      // Pop arguments and check types.
  	      int arg_count = _Jv_count_arguments (method_signature);
 -	      type arg_types[arg_count];
 -	      compute_argument_types (method_signature, arg_types);
 +              type *arg_types = compute_argument_types( method_signature, arg_count );
  	      for (int i = arg_count - 1; i >= 0; --i)
  		{
  		  // This is only used for verifying the byte for
 @@ -2756,6 +2778,7 @@
  		  nargs -= arg_types[i].depth ();
  		  pop_type (arg_types[i]);
  		}
 +              delete []arg_types;
  
  	      if (opcode == op_invokeinterface
  		  && nargs != 1)
 
 
 
 Tom Tromey wrote:
 
 >>>>>>">" == toddastock  <toddastock@yahoo.com> writes:
 >>>>>>
 >
 >>>Index: libjava/verify.cc
 >>>===================================================================
 >>>RCS file: /cvsroot/gcc/gcc/libjava/verify.cc,v
 >>>retrieving revision 1.35
 >>>diff -r1.35 verify.cc
 >>>
 >
 >Could you resend unidiffs ("diff -u"), not plain diffs?  The former
 >are much easier to handle.  Be sure to CC gcc-gnats so that the patch
 >ends up in the PR.
 >
 >Thanks,
 >Tom
 >
 
 
 
 
 _________________________________________________________
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 


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

* Re: libgcj/5670: verify.cc not properly merging states
@ 2002-02-12 10:46 Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2002-02-12 10:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libgcj/5670; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: toddastock@yahoo.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libgcj/5670: verify.cc not properly merging states
Date: 12 Feb 2002 11:59:03 -0700

 >>>>> ">" == toddastock  <toddastock@yahoo.com> writes:
 
 >> Index: libjava/verify.cc
 >> ===================================================================
 >> RCS file: /cvsroot/gcc/gcc/libjava/verify.cc,v
 >> retrieving revision 1.35
 >> diff -r1.35 verify.cc
 
 Could you resend unidiffs ("diff -u"), not plain diffs?  The former
 are much easier to handle.  Be sure to CC gcc-gnats so that the patch
 ends up in the PR.
 
 Thanks,
 Tom


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

* libgcj/5670: verify.cc not properly merging states
@ 2002-02-12 10:16 toddastock
  0 siblings, 0 replies; 6+ messages in thread
From: toddastock @ 2002-02-12 10:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5670
>Category:       libgcj
>Synopsis:       verify.cc not properly merging states
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 12 10:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1 20020211 (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:
	A problem occurs in the merge state when your comparing two merged states and the source is an interface.
>How-To-Repeat:
This code produces an error during verification because logger initially is TestLogger and then is set to TestLoggerDefault (which inherits TestLogger).  TestLoggerDefault will case into TestLogger, but only if you run down it's interface chain.
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( );
      t.doit( );
    }

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

  private TestLogger doit ()
    {
      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;
    }

  protected void addListener( Test2 t )
    {
      t.addTestListener( doit() );
    }
  }
public class Test2
  {

  public void addTestListener ( TestListener t )
    {
    }

  }
public interface TestListener
  {
  }
public interface TestLogger extends TestListener
  {
  void print ( int y );
  }
public class TestLoggerDefault implements TestLogger
  {

  public void print ( int y )
    {
    }

  }
>Fix:
Index: libjava/verify.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/verify.cc,v
retrieving revision 1.35
diff -r1.35 verify.cc
261a262,274
> 	else if (source->isInterface ())
> 	  {
> 	    for (int i = 0; i < target->interface_count; ++i)
> 	      {
> 		// We use a recursive call because we also need to
> 		// check superinterfaces.
> 		if (is_assignable_from_slow (target->interfaces[i], source))
> 		    return true;
> 	      }
> 	    target = target->getSuperclass ();
> 	    if (target == NULL)
> 	      return false;
> 	  }
>Release-Note:
>Audit-Trail:
>Unformatted:


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-14  9:52 libgcj/5670: verify.cc not properly merging states tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-02-14 17:56 Tom Tromey
2002-02-14 10:46 Todd Stock
2002-02-12 11:06 Todd Stock
2002-02-12 10:46 Tom Tromey
2002-02-12 10:16 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).