From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18490 invoked by alias); 2 Aug 2011 19:56:39 -0000 Received: (qmail 18469 invoked by uid 22791); 2 Aug 2011 19:56:38 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from master.pcc.me.uk (HELO master.pcc.me.uk) (207.192.74.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Aug 2011 19:56:23 +0000 Received: from dyn1194-29.wlan.ic.ac.uk ([129.31.194.29] helo=lapas.pcc.me.uk) by master.pcc.me.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QoL4g-00027U-SD; Tue, 02 Aug 2011 20:56:22 +0100 Received: from peter by lapas.pcc.me.uk with local (Exim 4.72) (envelope-from ) id 1QoL4V-0001Wo-SB; Tue, 02 Aug 2011 20:56:11 +0100 From: Peter Collingbourne To: gcc-patches@gcc.gnu.org, java-patches@gcc.gnu.org Cc: Peter Collingbourne Subject: [PATCH][JAVA] Build a correct tree for rewritten method invocations Date: Tue, 02 Aug 2011 19:56:00 -0000 Message-Id: <1312314963-5829-1-git-send-email-peter@pcc.me.uk> Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2011-q3/txt/msg00024.txt.bz2 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 * 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