gcj/253: problems with instanceof when compilation from .class files

Bryce McKinlay bryce@albatross.co.nz
Wed Jun 7 00:16:00 GMT 2000


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

From: Bryce McKinlay <bryce@albatross.co.nz>
To: warnes@biostat.washington.edu
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/253: problems with instanceof when compilation from .class files
Date: Wed, 07 Jun 2000 19:04:35 +1200

 This is a multi-part message in MIME format.
 --------------3C536C760DB23502E6ED1841
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Here is a proposed patch. It should fix your test case and the
 InterfaceDispatch.java regression. Can you try it out?
 
 regards
 
   [ bryce ]
 
 
 
 --------------3C536C760DB23502E6ED1841
 Content-Type: text/plain; charset=us-ascii;
  name="pr253.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="pr253.patch"
 
 2000-06-07  Bryce McKinlay  <bryce@albatross.co.nz>
 
 	* expr.c (build_instanceof): Load VALTYPE if neccessary. 
 	Don't assume false if TYPE is an array type. Fix for the PR gcj/253.
 
 Index: expr.c
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
 retrieving revision 1.76
 diff -u -r1.76 expr.c
 --- expr.c	2000/05/31 23:55:54	1.76
 +++ expr.c	2000/06/07 06:55:42
 @@ -1065,18 +1065,25 @@
    tree expr;
    tree itype = TREE_TYPE (TREE_TYPE (soft_instanceof_node));
    tree valtype = TREE_TYPE (TREE_TYPE (value));
 -  tree valclass = TYPE_NAME (valtype);
 +  tree valclass;
    tree klass;
  
 -  /* When compiling from bytecode, we need to ensure that TYPE has
 -     been loaded.  */
 +  /* When compiling from bytecode, we need to ensure that TYPE and VALTYPE have
 +     been loaded. lame. */
    if (CLASS_P (type) && ! CLASS_LOADED_P (type))
      {
        load_class (type, 1);
        if (! TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) == ERROR_MARK)
  	return error_mark_node;
 +    }    
 +  if (CLASS_P (valtype) && ! CLASS_LOADED_P (valtype))
 +    {
 +      load_class (valtype, 1);
 +      if (! TYPE_SIZE (valtype) || TREE_CODE (TYPE_SIZE (valtype)) == ERROR_MARK)
 +	return error_mark_node;
      }
    klass = TYPE_NAME (type);
 +  valclass = TYPE_NAME (valtype);
  
    if (type == object_type_node || inherits_from_p (valtype, type))
      {
 @@ -1090,6 +1097,7 @@
    else if (! CLASS_INTERFACE (valclass)
  	   && ! CLASS_INTERFACE (klass)
  	   && ! inherits_from_p (type, valtype)
 +	   && ! TYPE_ARRAY_P (type)
  	   && (CLASS_FINAL (klass)
  	       || ! inherits_from_p (valtype, type)))
      {
 
 --------------3C536C760DB23502E6ED1841--
 


More information about the Java-prs mailing list