summaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-23 21:19:50 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-23 21:19:50 +0000
commit22626fd1851ed3da4078e503a1a0a190d5318c98 (patch)
tree4d25331ad08a441f2ed71d7a18d95b012de7da72 /gcc/java/expr.c
parentab84aad4af1174c0580e4f1d8b7c3e88f170095a (diff)
downloadgcc-22626fd1851ed3da4078e503a1a0a190d5318c98.tar.gz
* expr.c (build_known_method_ref): Use method's context to find
method table index. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61670 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index bf1f41b5414..5ce92e00376 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -1748,13 +1748,16 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
SELF_TYPE->methods[METHOD_INDEX].ncode
- This is guaranteed to work (assuming SELF_TYPE has
- been initialized), since if the method is not compiled yet,
- its ncode points to a trampoline that forces compilation. */
+ */
int method_index = 0;
- tree meth;
- tree ref = build_class_ref (self_type);
+ tree meth, ref;
+
+ /* The method might actually be declared in some superclass, so
+ we have to use its class context, not the caller's notion of
+ where the method is. */
+ self_type = DECL_CONTEXT (method);
+ ref = build_class_ref (self_type);
ref = build1 (INDIRECT_REF, class_type_node, ref);
if (ncode_ident == NULL_TREE)
ncode_ident = get_identifier ("ncode");