From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9341 invoked by alias); 23 Dec 2001 00:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 9282 invoked by uid 71); 23 Dec 2001 00:06:00 -0000 Resent-Date: 23 Dec 2001 00:06:00 -0000 Resent-Message-ID: <20011223000600.9281.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, bryce@waitaki.otago.ac.nz Received:(qmail 8570 invoked by uid 61); 23 Dec 2001 00:02:01 -0000 Message-Id:<20011223000201.8569.qmail@sources.redhat.com> Date: Sat, 22 Dec 2001 16:06:00 -0000 From: bryce@waitaki.otago.ac.nz Reply-To: bryce@waitaki.otago.ac.nz To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: java/5178: Method call on qualified static field doesn't initialize its class X-SW-Source: 2001-12/txt/msg01073.txt.bz2 List-Id: >Number: 5178 >Category: java >Synopsis: Method call on qualified static field doesn't initialize its class >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Dec 22 16:06:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Bryce McKinlay >Release: gcc version 3.1 20011221 (experimental) >Organization: >Environment: >Description: The test case below, derived from PR375.java, crashes because no class initialization for "Bar" is generated. This occurs when the qualified field name is enclosed in brackets but not otherwise. In the case which works, java_complete_lhs sees a CALL_EXPR and calls patch_method_invocation, which sees that the call is qualified and uses cut_identifier_in_qualified to "cut" the last element off the WFL identifier chain. resolve_qualified_expression_name sets found_decl to a DECL, which is wrapped with a class initialization in resolve_field_access. In the broken case, java_complete_lhs sees a EXPR_WITH_FILE_LOCATION and calls resolve_expression_name. resolve_qualified_expression_name sees the CALL_EXPR on the end of the WFL chain (because no "cut" has occured - but should it be there in the first place?) and ends up in the code for "Field access using a primary" which seems wrong, setting found_decl to a CALL_EXPR which subsquently confuses resolve_field_access into not building a class initialization. This may also be what causes the problem RTH saw on Alpha with the same test case: http://gcc.gnu.org/ml/java-patches/2001-q4/msg00501.html >How-To-Repeat: class Bar { static Integer I = new Integer(1); } public class Qual { public static void main(String[] args) { // System.out.println (Bar.I.toString()); // ok System.out.println ((Bar.I).toString()); // crash } } >Fix: >Release-Note: >Audit-Trail: >Unformatted: