[4.0 Regression] internal compiler error: in size_binop, at fold-const.c:1598

Andrew Haley aph@redhat.com
Fri Mar 4 16:32:00 GMT 2005


This is a corner case where my new ABI changes cause an ICE.

4.0 branch and mainline.

Andrew.


2005-03-04  Andrew Haley  <aph@redhat.com>

	* class.c (set_method_index): Don't set method_index if it is
	NULL_TREE.
	(layout_class_method): Don't complain about "non-static method foo
	overrides static method" in the case of indirect dispatch.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.220
diff -u -p -r1.220 class.c
--- class.c     24 Jan 2005 19:07:05 -0000      1.220
+++ class.c     4 Mar 2005 12:14:32 -0000
@@ -1476,14 +1476,19 @@ get_dispatch_table (tree type, tree this
 void
 set_method_index (tree decl, tree method_index)
 {
-  method_index = fold (convert (sizetype, method_index));
+  if (method_index != NULL_TREE)
+    {
+      /* method_index is null if we're using indirect dispatch.  */
+      method_index = fold (convert (sizetype, method_index));
 
-  if (TARGET_VTABLE_USES_DESCRIPTORS)
-    /* Add one to skip bogus descriptor for class and GC descriptor. */
-    method_index = size_binop (PLUS_EXPR, method_index, size_int (1));
-  else
-    /* Add 1 to skip "class" field of dtable, and 1 to skip GC descriptor.  */
-    method_index = size_binop (PLUS_EXPR, method_index, size_int (2));
+      if (TARGET_VTABLE_USES_DESCRIPTORS)
+       /* Add one to skip bogus descriptor for class and GC descriptor. */
+       method_index = size_binop (PLUS_EXPR, method_index, size_int (1));
+      else
+       /* Add 1 to skip "class" field of dtable, and 1 to skip GC
+          descriptor.  */
+       method_index = size_binop (PLUS_EXPR, method_index, size_int (2));
+    }
 
   DECL_VINDEX (decl) = method_index;
 }
@@ -2357,6 +2362,7 @@ layout_class_method (tree this_class, tr
          tree method_index = get_method_index (super_method);
          set_method_index (method_decl, method_index);
          if (method_index == NULL_TREE 
+             && ! flag_indirect_dispatch
              && !CLASS_FROM_SOURCE_P (this_class)
              && ! DECL_ARTIFICIAL (super_method))
            error ("%Jnon-static method '%D' overrides static method",



More information about the Java-patches mailing list