public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "suvarov454 at users dot sourceforge dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/16701] New: GCJ inlines private constants into other classes
Date: Sat, 24 Jul 2004 20:52:00 -0000	[thread overview]
Message-ID: <20040724205233.16701.suvarov454@users.sourceforge.net> (raw)

I get a compile error when a class uses a public constant from a different
class, which is initialized with the value of a private constant, which is (in
turn) based on the value of another private constant.

When I use the Sun, MicroSoft, Eclipse, or jikes compilers, it compiles fine.

With GCJ, it says that the first class is attempting to access a private member
of the second.

This error appears in both GCJ 3.3.4 (gcj-3.3 from Debian Sarge) and in the
"java-gui-branch" of GCJ 3.5.  I use ".../gcj -C *.java" to compile to CLASS files.

The error from v3.5 is:
Coords.java: In class `TestCoords':
Coords.java: In method `TestCoords.main(java.lang.String[])':
Coords.java:50: error: Can't access private field `Coords.MASK' from `TestCoords'.
           Integer.MAX_VALUE & Coords.MASK;
                                     ^
1 error

The error from v3.3.4 is:
Coords.java: In class `TestCoords':
Coords.java: In method `TestCoords.main(java.lang.String[])':
Coords.java:50: error: Can't access private field `Coords.MASK' from `TestCoords'.
           Integer.MAX_VALUE & Coords.MASK;
                                     ^
Coords.java:56: error: Can't access private field `Coords.SHIFT' from `TestCoords'.
           ( Integer.MAX_VALUE - Coords.MAX_BOARD_HEIGHT ) >> Coords.SHIFT;
                                                                    ^
2 errors

I've attached the two source files below.

-- 
           Summary: GCJ inlines private constants into other classes
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: suvarov454 at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16701


             reply	other threads:[~2004-07-24 20:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-24 20:52 suvarov454 at users dot sourceforge dot net [this message]
2004-07-24 20:53 ` [Bug java/16701] " suvarov454 at users dot sourceforge dot net
2004-07-24 20:54 ` suvarov454 at users dot sourceforge dot net
2004-07-28  0:38 ` mckinlay at redhat dot com
2004-07-28 21:33 ` [Bug java/16701] Error when constant initializer depends on another constant with restricted access mckinlay at redhat dot com
2004-08-02 21:20 ` cvs-commit at gcc dot gnu dot org
2004-08-02 21:22 ` mckinlay at redhat dot com

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=20040724205233.16701.suvarov454@users.sourceforge.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@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).