This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/14296] New: 3.4 regression: Method.Invoke
- From: "aph at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2004 17:47:07 -0000
- Subject: [Bug libgcj/14296] New: 3.4 regression: Method.Invoke
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcj 3.4 is broken because of a change to natMethod.cc in
http://gcc.gnu.org/ml/java-patches/2003-q4/txt00009.txt. A test case
is attached.
It seems like _Jv_isVirtualMethod is wrong, and has always been wrong.
Here is the logic in the runtime:
// Determine if METH gets an entry in a VTable.
static inline jboolean _Jv_isVirtualMethod (_Jv_Method *meth)
{
using namespace java::lang::reflect;
return (((meth->accflags & (Modifier::STATIC | Modifier::PRIVATE)) == 0)
&& meth->name->data[0] != '<');
}
and here is the corresponding logic in the compiler:
if (super_method != NULL_TREE && ! METHOD_PRIVATE (super_method))
{
DECL_VINDEX (method_decl) = DECL_VINDEX (super_method);
if (DECL_VINDEX (method_decl) == NULL_TREE
&& !CLASS_FROM_SOURCE_P (this_class))
error ("%Jnon-static method '%D' overrides static method",
method_decl, method_decl);
}
else if (! METHOD_FINAL (method_decl)
&& ! METHOD_PRIVATE (method_decl)
&& ! CLASS_FINAL (TYPE_NAME (this_class))
&& dtable_count)
{
DECL_VINDEX (method_decl) = dtable_count;
dtable_count = fold (build (PLUS_EXPR, integer_type_node,
dtable_count, integer_one_node));
}
The important thing to note here is that the compiler doesn't allocate
a new vtable entry for a method if the whole class is final. This
seems reasonable enough, but the runtime doesn't know that and it
tries to use the vtable index. Which is -1. Bang.
--
Summary: 3.4 regression: Method.Invoke
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: libgcj
AssignedTo: aph at redhat dot com
ReportedBy: aph at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14296