public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class
@ 2005-08-04 15:01 greenrd at greenrd dot org
2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-04 15:01 UTC (permalink / raw)
To: gcc-bugs
The following file is miscompiled by gcj -C:
public class Outer extends Thread {
public class Inner extends Thread {
private Inner () {
start ();
}
}
}
It uses the wrong "this" to call start():
Outer$Inner(Outer);
Code:
0: aload_0
1: aload_1
2: putfield #12; //Field this$0:LOuter;
5: aload_0
6: invokespecial #15; //Method java/lang/Thread."<init>":()V
9: aload_1
10: invokevirtual #18; //Method java/lang/Thread.start:()V
13: return
}
Sun's compiler outputs correct code:
private Outer$Inner(Outer);
Code:
0: aload_0
1: aload_1
2: putfield #1; //Field this$0:LOuter;
5: aload_0
6: invokespecial #2; //Method java/lang/Thread."<init>":()V
9: aload_0
10: invokevirtual #3; //Method start:()V
13: return
}
The difference is at 9.
Note: The bug does not occur if you just replace start() (which is declared in
java.lang.Thread) with notify() (which is declared in java.lang.Object).
--
Summary: Wrong "this" used when call made to superclass which is
also superclass of enclosing class
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: greenrd at greenrd dot org
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=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
@ 2005-08-04 15:05 ` greenrd at greenrd dot org
2005-08-04 15:23 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-04 15:05 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |18131, 23220
nThis| |
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
@ 2005-08-04 15:23 ` pinskia at gcc dot gnu dot org
2005-08-04 15:26 ` greenrd at greenrd dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-04 15:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-04 15:23 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-08-04 15:23:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
2005-08-04 15:23 ` pinskia at gcc dot gnu dot org
@ 2005-08-04 15:26 ` greenrd at greenrd dot org
2005-08-04 22:03 ` greenrd at greenrd dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-04 15:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From greenrd at greenrd dot org 2005-08-04 15:26 -------
The relevant part of the JLS is section 15.12.1 @
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#20448
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (2 preceding siblings ...)
2005-08-04 15:26 ` greenrd at greenrd dot org
@ 2005-08-04 22:03 ` greenrd at greenrd dot org
2005-08-07 11:51 ` greenrd at greenrd dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-04 22:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From greenrd at greenrd dot org 2005-08-04 22:03 -------
I'm testing a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |greenrd at greenrd dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (3 preceding siblings ...)
2005-08-04 22:03 ` greenrd at greenrd dot org
@ 2005-08-07 11:51 ` greenrd at greenrd dot org
2005-08-08 9:43 ` rmathew at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-07 11:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From greenrd at greenrd dot org 2005-08-07 11:51 -------
The patch is tested and is in the gcc patch queue @
http://www.dberlin.org/cgi-bin/patches.py
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (4 preceding siblings ...)
2005-08-07 11:51 ` greenrd at greenrd dot org
@ 2005-08-08 9:43 ` rmathew at gcc dot gnu dot org
2005-08-09 0:44 ` greenrd at greenrd dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2005-08-08 9:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rmathew at gcc dot gnu dot org 2005-08-08 09:43 -------
Another testcase:
------------------------------- 8< -------------------------------
class Snafu
{
public void whoami( )
{
System.out.println( this.getClass( ).getName( ));
}
}
public class PR23230 extends Snafu
{
class Foo extends Snafu
{
Foo( )
{
whoami( );
}
}
void bar( )
{
new Foo( );
}
public static void main( String[] args)
{
new PR23230( ).bar( );
}
}
------------------------------- 8< -------------------------------
--
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2005-
| |08/msg00321.html
Keywords| |patch
Last reconfirmed|2005-08-04 15:23:34 |2005-08-08 09:43:39
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (5 preceding siblings ...)
2005-08-08 9:43 ` rmathew at gcc dot gnu dot org
@ 2005-08-09 0:44 ` greenrd at greenrd dot org
2005-08-11 11:49 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-09 0:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From greenrd at greenrd dot org 2005-08-09 00:44 -------
*** Bug 23220 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO|23220 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (6 preceding siblings ...)
2005-08-09 0:44 ` greenrd at greenrd dot org
@ 2005-08-11 11:49 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:04 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-11 11:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-08-11 11:49 -------
Subject: Bug 23230
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: aph@gcc.gnu.org 2005-08-11 11:49:27
Modified files:
gcc/java : ChangeLog java-gimplify.c parse.y
Log message:
2005-08-10 Andrew Haley <aph@redhat.com>
* java-gimplify.c (java_gimplify_modify_expr): Fix any pointer
type mismatches to make legal GIMPLE.
2005-08-10 Robin Green <greenrd@greenrd.org>
PR java/23230:
* parse.y (maybe_use_access_method): Generalize check from
java.lang.Object to any superclass of current_class
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1652&r2=1.1653
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/java-gimplify.c.diff?cvsroot=gcc&r1=1.20&r2=1.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.550&r2=1.551
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (7 preceding siblings ...)
2005-08-11 11:49 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-11 13:04 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-11 13:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-08-11 13:04 -------
Subject: Bug 23230
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: aph@gcc.gnu.org 2005-08-11 13:03:51
Modified files:
gcc/java : ChangeLog parse.y
Log message:
2005-08-10 Robin Green <greenrd@greenrd.org>
PR java/23230:
* parse.y (maybe_use_access_method): Generalize check from
java.lang.Object to any superclass of current_class
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.26&r2=1.1556.2.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.528.6.1&r2=1.528.6.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug java/23230] Wrong "this" used when call made to superclass which is also superclass of enclosing class
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
` (8 preceding siblings ...)
2005-08-11 13:04 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-11 13:26 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-11 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-11 13:26 -------
Fixed in 4.0.2.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23230
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-08-11 13:26 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04 15:01 [Bug java/23230] New: Wrong "this" used when call made to superclass which is also superclass of enclosing class greenrd at greenrd dot org
2005-08-04 15:05 ` [Bug java/23230] " greenrd at greenrd dot org
2005-08-04 15:23 ` pinskia at gcc dot gnu dot org
2005-08-04 15:26 ` greenrd at greenrd dot org
2005-08-04 22:03 ` greenrd at greenrd dot org
2005-08-07 11:51 ` greenrd at greenrd dot org
2005-08-08 9:43 ` rmathew at gcc dot gnu dot org
2005-08-09 0:44 ` greenrd at greenrd dot org
2005-08-11 11:49 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:04 ` cvs-commit at gcc dot gnu dot org
2005-08-11 13:26 ` pinskia 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).