public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
@ 2005-03-06 19:50 ` pinskia at gcc dot gnu dot org
2005-03-09 14:51 ` rmathew at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-06 19:50 UTC (permalink / raw)
To: java-prs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-05 23:20 -------
Confirmed, note with -fdump-tree-all, we ICE also which seems wrong.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code, wrong-
| |code
Last reconfirmed|0000-00-00 00:00:00 |2005-03-05 23:20:15
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class
@ 2005-03-06 19:50 zbigniew at chyla dot homeip dot net
2005-03-06 19:50 ` [Bug java/20338] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: zbigniew at chyla dot homeip dot net @ 2005-03-06 19:50 UTC (permalink / raw)
To: java-prs
Here's very simple example of class that compiles fine but crashes during
execution. It has something to do with "private" modifier in method of nested
class - after removing "private" the problem disappears.
$ cat Outer.java
public class Outer {
public static void main(String[] args) {
Nested.test();
}
static class Nested {
private static void test() {
System.out.println("test");
}
}
}
$ gcj-4.0 -o outer --main=Outer Outer.java
$ ./outer
Exception in thread "main" java.lang.NullPointerException
at gnu.gcj.convert.Output_8859_1.write(java.lang.String, int, int, char[])
(/usr/lib/libgcj.so.6.0.0)
at java.io.PrintStream.writeChars(java.lang.String, int, int)
(/usr/lib/libgcj.so.6.0.0)
at java.io.PrintStream.print(java.lang.String, boolean)
(/usr/lib/libgcj.so.6.0.0)
at java.io.PrintStream.println(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at Outer$Nested.test() (Unknown Source)
at Outer.main(java.lang.String[]) (Unknown Source)
--
Summary: Program compiled with gcj crashes when accessing private
static method from nested class
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zbigniew at chyla dot homeip dot net
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=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
2005-03-06 19:50 ` [Bug java/20338] " pinskia at gcc dot gnu dot org
@ 2005-03-09 14:51 ` rmathew at gcc dot gnu dot org
2005-03-09 17:48 ` rmathew at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-03-09 14:51 UTC (permalink / raw)
To: java-prs
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-03-09 12:39 -------
The problem is that we leave out a call to _Jv_InitClass for a static
private method thinking that it is unreachable. This is not the case
for a private static inner class method. A simple pessimistic
fix is:
Index: decl.c
===================================================================
--- decl.c 2005-03-09 17:16:36.000000000 +0530
+++ decl.c 2005-03-09 17:17:18.000000000 +0530
@@ -2039,5 +2039,5 @@ finish_method (tree fndecl)
/* Prepend class initialization for static methods reachable from
other classes. */
- if (METHOD_STATIC (fndecl) && ! METHOD_PRIVATE (fndecl)
+ if (METHOD_STATIC (fndecl)
&& ! DECL_CLINIT_P (fndecl)
&& ! CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (fndecl))))
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2005-03-05 23:20:15 |2005-03-09 12:39:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
2005-03-06 19:50 ` [Bug java/20338] " pinskia at gcc dot gnu dot org
2005-03-09 14:51 ` rmathew at gcc dot gnu dot org
@ 2005-03-09 17:48 ` rmathew at gcc dot gnu dot org
2005-03-09 18:52 ` mckinlay at redhat dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-03-09 17:48 UTC (permalink / raw)
To: java-prs
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-03-09 14:51 -------
A proposed patch is here:
http://gcc.gnu.org/ml/java-patches/2005-q1/msg00684.html
As noted there, there is still a problem with either
GCJ or gij for this testcase.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
` (2 preceding siblings ...)
2005-03-09 17:48 ` rmathew at gcc dot gnu dot org
@ 2005-03-09 18:52 ` mckinlay at redhat dot com
2005-03-09 21:21 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mckinlay at redhat dot com @ 2005-03-09 18:52 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2005-03-09 18:06 -------
Other Java compilers generate "accessor" methods for calls to private methods in
a nested class, the real bug here is that GCJ doesn't do this - thats why the
javac bytecode works fine on gij but gcj-produced bytecode does not.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
` (3 preceding siblings ...)
2005-03-09 18:52 ` mckinlay at redhat dot com
@ 2005-03-09 21:21 ` cvs-commit at gcc dot gnu dot org
2005-03-10 13:10 ` rmathew at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-09 21:21 UTC (permalink / raw)
To: java-prs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-03-09 19:05 -------
Subject: Bug 20338
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rmathew@gcc.gnu.org 2005-03-09 19:04:55
Modified files:
gcc/java : ChangeLog decl.c
Log message:
PR java/20338
* decl.c (finish_method): Emit _Jv_InitClass for private static
methods inside inner classes as well.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1569&r2=1.1570
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/decl.c.diff?cvsroot=gcc&r1=1.211&r2=1.212
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
` (4 preceding siblings ...)
2005-03-09 21:21 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-10 13:10 ` rmathew at gcc dot gnu dot org
2005-03-10 13:30 ` mckinlay at redhat dot com
2005-03-10 18:40 ` rmathew at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-03-10 13:10 UTC (permalink / raw)
To: java-prs
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-03-10 11:00 -------
While the main problem reported by the filer has now been fixed on
mainline, I think we should not close this PR just yet - not until
we check in a testcase for our testsuite for this, which is not
possible till PR19870 is fixed.
Otherwise, we can close this one and add a note to PR19870
to remember to add in the testcase for this PR when that is
fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |19870
Status|NEW |SUSPENDED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
` (5 preceding siblings ...)
2005-03-10 13:10 ` rmathew at gcc dot gnu dot org
@ 2005-03-10 13:30 ` mckinlay at redhat dot com
2005-03-10 18:40 ` rmathew at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: mckinlay at redhat dot com @ 2005-03-10 13:30 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2005-03-10 11:30 -------
Why not check in the test case and XFAIL it?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug java/20338] Program compiled with gcj crashes when accessing private static method from nested class
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
` (6 preceding siblings ...)
2005-03-10 13:30 ` mckinlay at redhat dot com
@ 2005-03-10 18:40 ` rmathew at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-03-10 18:40 UTC (permalink / raw)
To: java-prs
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-03-10 12:00 -------
(In reply to comment #7)
> Why not check in the test case and XFAIL it?
I feel dumb for not having thought of it myself...
I am closing this bug and will submit the testcase as
a separate patch. Thanks.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|19870 |
Status|SUSPENDED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20338
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-03-10 12:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-06 19:50 [Bug java/20338] New: Program compiled with gcj crashes when accessing private static method from nested class zbigniew at chyla dot homeip dot net
2005-03-06 19:50 ` [Bug java/20338] " pinskia at gcc dot gnu dot org
2005-03-09 14:51 ` rmathew at gcc dot gnu dot org
2005-03-09 17:48 ` rmathew at gcc dot gnu dot org
2005-03-09 18:52 ` mckinlay at redhat dot com
2005-03-09 21:21 ` cvs-commit at gcc dot gnu dot org
2005-03-10 13:10 ` rmathew at gcc dot gnu dot org
2005-03-10 13:30 ` mckinlay at redhat dot com
2005-03-10 18:40 ` rmathew 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).