public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/19285] New: Interfaces not initialized by static field access
@ 2005-01-06  2:19 mckinlay at redhat dot com
  2005-01-06  2:19 ` [Bug java/19285] " mckinlay at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mckinlay at redhat dot com @ 2005-01-06  2:19 UTC (permalink / raw)
  To: java-prs

Consider the following test case:

public class Test implements RuntimeConstants
{
  public static void main(String[] args)
  {
    System.out.println(foo[0]);
  }
}

interface RuntimeConstants 
{
  static int foo[] = {1};    
}

Older bytecode compilers would implement the access to "foo" like so:

  3: getstatic <Field RuntimeConstants.foo int[]>

However, presumably for reasons of binary compatibility, bytecode produced by
some modern Java compilers (javac 1.5.0 with "-target" >= 1.3) does the following:

  3: getstatic <Field Test.foo int[]>

When "foo" is actually in an interface, there is a problem for GCJ because we
have no way to ensure that the interface gets initialized when it is accessed.
Initialization of a class does not itself cause initialization of its
superinterfaces.

-- 
           Summary: Interfaces not initialized by static field access
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mckinlay at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
@ 2005-01-06  2:19 ` mckinlay at redhat dot com
  2005-01-06  2:56 ` tromey at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mckinlay at redhat dot com @ 2005-01-06  2:19 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2005-01-06 02:19 -------
gij also fails to execute this bytecode:

$ gij Test
Exception in thread "main" java.lang.IncompatibleClassChangeError: field
Test.foo was not found.
   at Test.main (Test.java:5)



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
  2005-01-06  2:19 ` [Bug java/19285] " mckinlay at redhat dot com
@ 2005-01-06  2:56 ` tromey at gcc dot gnu dot org
  2005-01-06 14:21 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-01-06  2:56 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-01-06 02:56 -------
This is somewhat related to PR 18868, which has to do
with field lookup in this situation.
For the interpreter this seems simple to fix.
For indirect-dispatch, the init-class call needs to
somehow use the really-declaring class as found during linking.


-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
  2005-01-06  2:19 ` [Bug java/19285] " mckinlay at redhat dot com
  2005-01-06  2:56 ` tromey at gcc dot gnu dot org
@ 2005-01-06 14:21 ` pinskia at gcc dot gnu dot org
  2005-04-21 15:39 ` aph at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-06 14:21 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-06 14:21 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-06 14:21:32
               date|                            |


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (2 preceding siblings ...)
  2005-01-06 14:21 ` pinskia at gcc dot gnu dot org
@ 2005-04-21 15:39 ` aph at gcc dot gnu dot org
  2005-04-29 18:35 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: aph at gcc dot gnu dot org @ 2005-04-21 15:39 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aph at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (3 preceding siblings ...)
  2005-04-21 15:39 ` aph at gcc dot gnu dot org
@ 2005-04-29 18:35 ` cvs-commit at gcc dot gnu dot org
  2005-04-29 18:43 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-29 18:35 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-29 18:35 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2005-04-29 18:35:37

Modified files:
	libjava        : prims.cc link.cc ChangeLog 
	libjava/include: jvm.h 

Log message:
	2005-04-27  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* prims.cc (_Jv_ResolvePoolEntry): New function.
	* include/jvm.h (_Jv_Linker::find_field): New arg: found_class.
	* link.cc (_Jv_Linker::find_field): New arg: found_class.
	(resolve_pool_entry): Initialize the class in which a field is
	found.
	(link_symbol_table): Pass new arg to found_class.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/prims.cc.diff?cvsroot=gcc&r1=1.110&r2=1.111
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/link.cc.diff?cvsroot=gcc&r1=1.13&r2=1.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3578&r2=1.3579
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/jvm.h.diff?cvsroot=gcc&r1=1.83&r2=1.84



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (4 preceding siblings ...)
  2005-04-29 18:35 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-29 18:43 ` cvs-commit at gcc dot gnu dot org
  2005-04-29 18:44 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-29 18:43 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-29 18:42 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2005-04-29 18:42:50

Modified files:
	gcc/java       : java-tree.h expr.c decl.c class.c constants.c 
	                 ChangeLog 

Log message:
	2005-04-28  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* java-tree.h (soft_resolvepoolentry_node): New.
	(alloc_constant_fieldref): Declare.
	* expr.c (expand_java_field_op): Don't call class_init for
	accesses to static fields with indirect dispatch.
	* builtins.c (initialize_builtins): Add "__builtin_expect".
	* decl.c (soft_resolvepoolentry_node): New variable.
	(java_init_decl_processing): Create a decl for
	"_Jv_ResolvePoolEntry".
	* class.c (build_fieldref_cache_entry): New function.
	(build_static_field_ref): Rewrite for indirect dispatch.
	* constants.c (find_name_and_type_constant_tree): New function.
	(alloc_constant_fieldref): Likewise.
	(build_constants_constructor): Handle CONSTANT_Fieldref and
	CONSTANT_NameAndType.
	
	PR java/21115
	* expr.c (force_evaluation_order): Convert outgoing args smaller
	than integer.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&r1=1.229&r2=1.230
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/expr.c.diff?cvsroot=gcc&r1=1.222&r2=1.223
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.218&r2=1.219
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/class.c.diff?cvsroot=gcc&r1=1.224&r2=1.225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/constants.c.diff?cvsroot=gcc&r1=1.40&r2=1.41
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1601&r2=1.1602



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (5 preceding siblings ...)
  2005-04-29 18:43 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-29 18:44 ` cvs-commit at gcc dot gnu dot org
  2005-05-09 13:56 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-29 18:44 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-29 18:43 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2005-04-29 18:43:25

Modified files:
	gcc/java       : builtins.c 

Log message:
	2005-04-28  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* java-tree.h (soft_resolvepoolentry_node): New.
	(alloc_constant_fieldref): Declare.
	* expr.c (expand_java_field_op): Don't call class_init for
	accesses to static fields with indirect dispatch.
	* builtins.c (initialize_builtins): Add "__builtin_expect".
	* decl.c (soft_resolvepoolentry_node): New variable.
	(java_init_decl_processing): Create a decl for
	"_Jv_ResolvePoolEntry".
	* class.c (build_fieldref_cache_entry): New function.
	(build_static_field_ref): Rewrite for indirect dispatch.
	* constants.c (find_name_and_type_constant_tree): New function.
	(alloc_constant_fieldref): Likewise.
	(build_constants_constructor): Handle CONSTANT_Fieldref and
	CONSTANT_NameAndType.
	
	PR java/21115
	* expr.c (force_evaluation_order): Convert outgoing args smaller
	than integer.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/builtins.c.diff?cvsroot=gcc&r1=1.29&r2=1.30



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (6 preceding siblings ...)
  2005-04-29 18:44 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-09 13:56 ` cvs-commit at gcc dot gnu dot org
  2005-05-09 13:59 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-09 13:56 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-09 13:41 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	aph@gcc.gnu.org	2005-05-09 13:32:30

Modified files:
	libjava        : ChangeLog prims.cc link.cc 
	libjava/include: jvm.h 

Log message:
	2005-04-27  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* prims.cc (_Jv_ResolvePoolEntry): New function.
	* include/jvm.h (_Jv_Linker::find_field): New arg: found_class.
	* link.cc (_Jv_Linker::find_field): New arg: found_class.
	(resolve_pool_entry): Initialize the class in which a field is
	found.
	(link_symbol_table): Pass new arg to found_class.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3391.2.59&r2=1.3391.2.60
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/prims.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.104.2.3&r2=1.104.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/link.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.10.2.2&r2=1.10.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/jvm.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.77.2.3&r2=1.77.2.4



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (7 preceding siblings ...)
  2005-05-09 13:56 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-09 13:59 ` cvs-commit at gcc dot gnu dot org
  2005-05-09 14:10 ` cvs-commit at gcc dot gnu dot org
  2005-05-10 21:03 ` tromey at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-09 13:59 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-09 13:48 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	aph@gcc.gnu.org	2005-05-09 13:34:33

Modified files:
	libjava/java/lang: Class.h 

Log message:
	2005-04-27  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* prims.cc (_Jv_ResolvePoolEntry): New function.
	* include/jvm.h (_Jv_Linker::find_field): New arg: found_class.
	* link.cc (_Jv_Linker::find_field): New arg: found_class.
	(resolve_pool_entry): Initialize the class in which a field is
	found.
	(link_symbol_table): Pass new arg to found_class.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/Class.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.78.2.1&r2=1.78.2.2



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (8 preceding siblings ...)
  2005-05-09 13:59 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-09 14:10 ` cvs-commit at gcc dot gnu dot org
  2005-05-10 21:03 ` tromey at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-09 14:10 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-09 14:00 -------
Subject: Bug 19285

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	aph@gcc.gnu.org	2005-05-09 13:50:01

Modified files:
	gcc/java       : ChangeLog java-tree.h expr.c builtins.c decl.c 
	                 class.c constants.c 

Log message:
	2005-04-28  Andrew Haley  <aph@redhat.com>
	
	PR java/19285
	* java-tree.h (soft_resolvepoolentry_node): New.
	(alloc_constant_fieldref): Declare.
	* expr.c (expand_java_field_op): Don't call class_init for
	accesses to static fields with indirect dispatch.
	* builtins.c (initialize_builtins): Add "__builtin_expect".
	* decl.c (soft_resolvepoolentry_node): New variable.
	(java_init_decl_processing): Create a decl for
	"_Jv_ResolvePoolEntry".
	* class.c (build_fieldref_cache_entry): New function.
	* class.c (build_static_field_ref): New function.
	(build_static_field_ref): Rewrite for indirect dispatch.
	* constants.c (find_name_and_type_constant_tree): New function.
	(alloc_constant_fieldref): Likewise.
	(build_constants_constructor): Handle CONSTANT_Fieldref and
	CONSTANT_NameAndType.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1556.2.18&r2=1.1556.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.226&r2=1.226.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.218.4.3&r2=1.218.4.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/builtins.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.29&r2=1.29.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.209.4.2&r2=1.209.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/class.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.220.8.1&r2=1.220.8.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/constants.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.40&r2=1.40.34.1



-- 


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


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

* [Bug java/19285] Interfaces not initialized by static field access
  2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
                   ` (9 preceding siblings ...)
  2005-05-09 14:10 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-10 21:03 ` tromey at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-05-10 21:03 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-05-10 21:03 -------
Fix checked in.


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


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


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

end of thread, other threads:[~2005-05-10 21:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-06  2:19 [Bug java/19285] New: Interfaces not initialized by static field access mckinlay at redhat dot com
2005-01-06  2:19 ` [Bug java/19285] " mckinlay at redhat dot com
2005-01-06  2:56 ` tromey at gcc dot gnu dot org
2005-01-06 14:21 ` pinskia at gcc dot gnu dot org
2005-04-21 15:39 ` aph at gcc dot gnu dot org
2005-04-29 18:35 ` cvs-commit at gcc dot gnu dot org
2005-04-29 18:43 ` cvs-commit at gcc dot gnu dot org
2005-04-29 18:44 ` cvs-commit at gcc dot gnu dot org
2005-05-09 13:56 ` cvs-commit at gcc dot gnu dot org
2005-05-09 13:59 ` cvs-commit at gcc dot gnu dot org
2005-05-09 14:10 ` cvs-commit at gcc dot gnu dot org
2005-05-10 21:03 ` tromey at gcc dot gnu dot org

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