public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/16701] New: GCJ inlines private constants into other classes
@ 2004-07-24 20:52 suvarov454 at users dot sourceforge dot net
  2004-07-24 20:53 ` [Bug java/16701] " suvarov454 at users dot sourceforge dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: suvarov454 at users dot sourceforge dot net @ 2004-07-24 20:52 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] GCJ inlines private constants into other classes
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
@ 2004-07-24 20:53 ` suvarov454 at users dot sourceforge dot net
  2004-07-24 20:54 ` suvarov454 at users dot sourceforge dot net
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: suvarov454 at users dot sourceforge dot net @ 2004-07-24 20:53 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From suvarov454 at users dot sourceforge dot net  2004-07-24 20:53 -------
Created an attachment (id=6820)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6820&action=view)
Class with the constants


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] GCJ inlines private constants into other classes
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: suvarov454 at users dot sourceforge dot net @ 2004-07-24 20:54 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From suvarov454 at users dot sourceforge dot net  2004-07-24 20:54 -------
Created an attachment (id=6821)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6821&action=view)
Class that uses the public constant; gets the compile error.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] GCJ inlines private constants into other classes
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-28  0:38 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-28 00:38 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-28 00:38:22
               date|                            |


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] Error when constant initializer depends on another constant with restricted access
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2004-07-28  0:38 ` mckinlay at redhat dot com
@ 2004-07-28 21:33 ` 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
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-28 21:33 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-07-28 21:33 -------
I submitted a patch for this:

http://gcc.gnu.org/ml/java-patches/2004-q3/msg00388.html


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] Error when constant initializer depends on another constant with restricted access
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-02 21:20 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-02 21:20 -------
Subject: Bug 16701

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bryce@gcc.gnu.org	2004-08-02 21:20:46

Modified files:
	libjava        : ChangeLog 
	gcc/java       : ChangeLog parse.y 
Added files:
	libjava/testsuite/libjava.compile: PR16701.java 

Log message:
	2004-08-02  Bryce McKinlay  <mckinlay@redhat.com>
	
	PR java/16701
	* parse.y (fold_constant_for_init): Call resolve_field_access with
	correct current_class context.
	
	2004-08-02  Bryce McKinlay  <mckinlay@redhat.com>
	
	* testsuite/libjava.compile/PR16701.java: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.2982&r2=1.2983
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1428&r2=1.1429
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.497&r2=1.498
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR16701.java.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/16701] Error when constant initializer depends on another constant with restricted access
  2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
                   ` (4 preceding siblings ...)
  2004-08-02 21:20 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-02 21:22 ` mckinlay at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: mckinlay at redhat dot com @ 2004-08-02 21:22 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-08-02 21:21 -------
Fix checked in.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.5.0


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-02 21:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-24 20:52 [Bug java/16701] New: GCJ inlines private constants into other classes suvarov454 at users dot sourceforge dot net
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

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).