public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tromey@redhat.com
To: gcc-gnats@gcc.gnu.org
Subject: middle-end/6608: code generation bug when building libgcj
Date: Wed, 08 May 2002 11:36:00 -0000	[thread overview]
Message-ID: <20020508183430.28662.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-05-08 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-08 11:36 tromey [this message]
2003-03-22 14:47 ebotcazou
2003-03-26 17:16 tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020508183430.28662.qmail@sources.redhat.com \
    --to=tromey@redhat.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).