Patch: RFA: Fix for PR java/17216
Tom Tromey
tromey@redhat.com
Mon Aug 30 15:27:00 GMT 2004
This fixes PR java/17216.
`javac -target 1.1' will emit redeclarations of Miranda methods in the
abstract class where they enter the concrete class hierarchy. These
redeclarations are marked Synthetic.
In the test case in the PR, the subclass implements the method, so the
search in layout_class_method finds an overridden method. However,
synthetic (DECL_ARTIFICIAL) methods aren't included in the vtable
layout; so we see a crash because the overriding method in the
subclass ends up with a NULL vtable index.
I don't see why DECL_ARTIFICIAL methods should be omitted from the
vtable. Is there a reason? Removing this doesn't seem to cause any
problems.
I'm not sure what to do about a test case in cvs. I don't think we
want our test suite to rely on javac, and gcj doesn't generate code
like this.
Tested on x86 Linux (RHL 9).
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR java/17216:
* class.c (layout_class_method): Put synthetic methods into the
vtable.
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.202
diff -u -r1.202 class.c
--- class.c 15 Aug 2004 15:45:29 -0000 1.202
+++ class.c 28 Aug 2004 00:50:50 -0000
@@ -2208,7 +2208,7 @@
DECL_CONSTRUCTOR_P (method_decl) = 1;
build_java_argument_signature (TREE_TYPE (method_decl));
}
- else if (! METHOD_STATIC (method_decl) && !DECL_ARTIFICIAL (method_decl))
+ else if (! METHOD_STATIC (method_decl))
{
tree method_sig =
build_java_argument_signature (TREE_TYPE (method_decl));
More information about the Java-patches
mailing list