public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/16677] New: GCJ fails to reject invalid code
@ 2004-07-22 21:34 vadimn at redhat dot com
2004-07-22 21:53 ` [Bug libgcj/16677] Failure to reject illegal access to enclosing "this" across static context mckinlay at redhat dot com
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: vadimn at redhat dot com @ 2004-07-22 21:34 UTC (permalink / raw)
To: java-prs
In the process of producing a test case for PR16675, we ran across
another bug. See below.
Bryce points out that it is similar to PR9884. As far as I can tell,
it's the exact same issue, in which case please mark this as a
duplicate. Here goes.
The following snippet of code is not valid.
| $ cat Test.java
| public class Test {
| public static void main(String[] s) {
| new Object() {
| public String toString() {
| return "enclosing class: " + Test.this.getClass();
| }
| }.toString();
| }
| }
Sun's javac compiler correctly rejects it like so:
| $ java -version
| java version "1.4.2_04"
| Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
| Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
| $ javac Test.java
| Test.java:5: non-static variable this cannot be referenced from a static context
| return "enclosing class: " + Test.this.getClass();
| ^
| 1 error
| $ echo $?
| 1
GCJ accepts it:
| $ gcj -C Test.java
| $ echo $?
| 0
The generated bytecode produces a runtime error:
| $ gij Test
| Exception in thread "main" java.lang.NullPointerException
| at Test$1.toString() (Unknown Source)
| at Test.main(java.lang.String[]) (Unknown Source)
--
Summary: GCJ fails to reject invalid code
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vadimn 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=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libgcj/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
@ 2004-07-22 21:53 ` mckinlay at redhat dot com
2004-07-22 21:53 ` [Bug java/16677] " mckinlay at redhat dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-22 21:53 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2004-07-22 21:53 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-07-22 21:53:37
date| |
Summary|GCJ fails to reject invalid |Failure to reject illegal
|code |access to enclosing "this"
| |across static context
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
2004-07-22 21:53 ` [Bug libgcj/16677] Failure to reject illegal access to enclosing "this" across static context mckinlay at redhat dot com
@ 2004-07-22 21:53 ` mckinlay at redhat dot com
2004-07-22 21:55 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-22 21:53 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2004-07-22 21:53 -------
Its a java bug.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|libgcj |java
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
2004-07-22 21:53 ` [Bug libgcj/16677] Failure to reject illegal access to enclosing "this" across static context mckinlay at redhat dot com
2004-07-22 21:53 ` [Bug java/16677] " mckinlay at redhat dot com
@ 2004-07-22 21:55 ` pinskia at gcc dot gnu dot org
2004-07-23 9:12 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22 21:55 UTC (permalink / raw)
To: java-prs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-22 21:55 -------
Actually this is a dup of bug 12459.
*** This bug has been marked as a duplicate of 12459 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
` (2 preceding siblings ...)
2004-07-22 21:55 ` pinskia at gcc dot gnu dot org
@ 2004-07-23 9:12 ` pinskia at gcc dot gnu dot org
2004-07-23 9:13 ` pinskia at gcc dot gnu dot org
2004-07-23 9:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-23 9:12 UTC (permalink / raw)
To: java-prs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-23 09:12 -------
Reopening because I was wrong, this is not a dup of that bug at all.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
` (3 preceding siblings ...)
2004-07-23 9:12 ` pinskia at gcc dot gnu dot org
@ 2004-07-23 9:13 ` pinskia at gcc dot gnu dot org
2004-07-23 9:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-23 9:13 UTC (permalink / raw)
To: java-prs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
` (4 preceding siblings ...)
2004-07-23 9:13 ` pinskia at gcc dot gnu dot org
@ 2004-07-23 9:24 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-23 9:24 UTC (permalink / raw)
To: java-prs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-23 09:24 -------
No this is not a dup of bug 9884 either, the real problem is that gcj creates a this$0 (of type Test) for
the inner Object class, this is just plainly wrong.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug java/16677] Failure to reject illegal access to enclosing "this" across static context
[not found] <bug-16677-8557@http.gcc.gnu.org/bugzilla/>
@ 2007-01-09 20:48 ` tromey at gcc dot gnu dot org
0 siblings, 0 replies; 8+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-09 20:48 UTC (permalink / raw)
To: java-prs
------- Comment #6 from tromey at gcc dot gnu dot org 2007-01-09 20:46 -------
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.
--
tromey at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16677
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-01-09 20:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22 21:34 [Bug libgcj/16677] New: GCJ fails to reject invalid code vadimn at redhat dot com
2004-07-22 21:53 ` [Bug libgcj/16677] Failure to reject illegal access to enclosing "this" across static context mckinlay at redhat dot com
2004-07-22 21:53 ` [Bug java/16677] " mckinlay at redhat dot com
2004-07-22 21:55 ` pinskia at gcc dot gnu dot org
2004-07-23 9:12 ` pinskia at gcc dot gnu dot org
2004-07-23 9:13 ` pinskia at gcc dot gnu dot org
2004-07-23 9:24 ` pinskia at gcc dot gnu dot org
[not found] <bug-16677-8557@http.gcc.gnu.org/bugzilla/>
2007-01-09 20:48 ` 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).