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]

[BC] Patch: FYI: fix up types in array accesses


I'm checking this in on the BC branch.

Andrew pointed out that a jar file from jonas caused a compiler crash
in aastore handling.  We weren't properly updating all the
type-related variables.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* expr.c (expand_java_arrayload): Set lhs_type_node.
	(expand_java_arraystore): Set rhs_type_node.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.185.2.18
diff -u -r1.185.2.18 expr.c
--- expr.c 2 Nov 2004 23:52:35 -0000 1.185.2.18
+++ expr.c 3 Nov 2004 20:32:46 -0000
@@ -1220,7 +1220,10 @@
       /* If we're processing an `aaload' we might as well just pick
 	 `Object'.  */
       if (TREE_CODE (rhs_type_node) == POINTER_TYPE)
-	array_type = build_java_array_type (object_ptr_type_node, -1);
+	{
+	  array_type = build_java_array_type (object_ptr_type_node, -1);
+	  rhs_type_node = object_ptr_type_node;
+	}
       else
 	array_type = build_java_array_type (rhs_type_node, -1);
     }
@@ -1267,7 +1270,10 @@
       /* If we're processing an `aaload' we might as well just pick
 	 `Object'.  */
       if (TREE_CODE (lhs_type_node) == POINTER_TYPE)
-	array_type = build_java_array_type (object_ptr_type_node, -1);
+	{
+	  array_type = build_java_array_type (object_ptr_type_node, -1);
+	  lhs_type_node = object_ptr_type_node;
+	}
       else
 	array_type = build_java_array_type (lhs_type_node, -1);
     }
@@ -1282,7 +1288,7 @@
 
   if (TREE_TYPE (array_node) == ptr_type_node)
     /* The only way we could get a node of type ptr_type_node at this
-      point is `aconst_null; arraylength' or something equivalent, so
+       point is `aconst_null; arraylength' or something equivalent, so
        unconditionally throw NullPointerException.  */
     load_node = build3 (CALL_EXPR, lhs_type_node, 
 			build_address_of (soft_nullpointer_node),


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