The Java frontend currently produces an incorrectly typed tree if a method call is rewritten. Specifically, the callee operand is a NOP_EXPR casting the address of the target method to the original method type. This patch causes the NOP_EXPR cast to use the type of the target method instead.
The bug is exposed by dragonegg which requires the callee type to be correct. libjava tested, x86_64-unknown-linux-gnu. 2011-08-02 Peter Collingbourne <pe...@pcc.me.uk> * expr.c (expand_invoke) Use the type of the method rewrite target. --- gcc/java/expr.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 4686f30..ec2d9b6 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2544,12 +2544,12 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) return; } - method_type = TREE_TYPE (method); - arg_list = pop_arguments (method_type); + arg_list = pop_arguments (TREE_TYPE (method)); flush_quick_stack (); maybe_rewrite_invocation (&method, &arg_list, &method_signature, &special); + method_type = TREE_TYPE (method); func = NULL_TREE; if (opcode == OPCODE_invokestatic) -- 1.7.5.3