From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30880 invoked by alias); 8 May 2002 18:36:00 -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 30860 invoked by uid 71); 8 May 2002 18:36:00 -0000 Resent-Date: 8 May 2002 18:36:00 -0000 Resent-Message-ID: <20020508183600.30859.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 Resent-Reply-To: gcc-gnats@gcc.gnu.org, tromey@redhat.com Received:(qmail 28667 invoked by uid 61); 8 May 2002 18:34:31 -0000 Message-Id:<20020508183430.28662.qmail@sources.redhat.com> Date: Wed, 08 May 2002 11:36:00 -0000 From: tromey@redhat.com Reply-To: tromey@redhat.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: middle-end/6608: code generation bug when building libgcj X-SW-Source: 2002-05/txt/msg00238.txt.bz2 List-Id: >Number: 6608 >Category: middle-end >Synopsis: code generation bug when building libgcj >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed May 08 11:36:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Tom Tromey >Release: gcj (GCC) 3.2 20020505 (experimental) >Organization: >Environment: >Description: I've found what I believe to be a code generation bug on the current cvs trunk. The bug apparently occurs when compiling the libgcj class java.lang.reflect.Modifier, in method isPublic(). The test case below, from the libgcj test suite, demonstrates the bug. It prints this: public private void KeepInline.example() public static void KeepInline.main(java.lang.String[]) Note the "public private". Here is what I see if I go to Modifier.isPublic in gdb: java.lang.reflect.Modifier.isPublic(int) (mod=2) at ../../../gcc/libjava/java/lang/reflect/Modifier.java:227 (gdb) p mod $5 = 2 (gdb) fini Run till exit from #0 java.lang.reflect.Modifier.isPublic(int) (mod=2) at ../../../gcc/libjava/java/lang/reflect/Modifier.java:227 0x40359dc1 in java.lang.reflect.Modifier.toString(int, java.lang.StringBuffer) (mod=2, r=@80b5be0) at ../../../gcc/libjava/java/lang/reflect/Modifier.java:302 Value returned is $6 = 2 This return value is wrong in two ways: * First, PUBLIC is 1, so the return value should be 0 * Second, the method returns a boolean so `2' is invalid anyway // Demonstrate that private methods can be reflected even if they are // not referenced at compile-time (i.e. -fkeep-inline-functions works). import java.lang.reflect.Method; public class KeepInline { private void example() { System.out.println("example"); } public static void main(String[] args) { try { KeepInline pr = new KeepInline(); Method[] meths = pr.getClass().getDeclaredMethods(); for (int n = 0; n < meths.length; n++) System.out.println(meths[n]); } catch (Throwable t) { t.printStackTrace(); } } } >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: