Bug 5640

Summary: gcj references wrong class in qualified method invocation
Product: gcc Reporter: ebb9
Component: javaAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, java-prs
Priority: P3 Keywords: wrong-code
Version: 3.0.4   
Target Milestone: 4.3.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2004-05-20 23:33:15
Bug Depends on: 28067    
Bug Blocks:    

Description ebb9 2002-02-09 01:56:00 UTC
From the Classpath mailing list:
http://mail.gnu.org/pipermail/classpath/2002-February/001909.html

This front-end bug in emitted class files, if fixed, will expose bugs in backend jits the same way classes compiled by JDK 1.4 or jikes 1.15a will.

Release:
3.0.4

Environment:
cygwin
Comment 1 ebb9 2002-02-09 01:56:00 UTC
Fix:
When emitting a qualified field or method reference, JLS 13 requires that the compiler link the reference to the type of the qualifying expression; even if that class only inherits the field or method.
Comment 2 Dara Hazeghi 2003-05-25 03:31:08 UTC
Hello,

could you please report whether this bug still occurs with current versions of gcc (ie 3.3)? The 
message referenced by this bug is not longer available, so if a working link to that could be 
provided, that would be great too. As always, testcases make it much easier to verify whether bugs 
are still present. Thanks,

Dara
Comment 3 Andrew Pinski 2003-08-24 00:19:17 UTC
Found the email: <http://mail.gnu.org/archive/html/classpath/2002-02/msg00112.html>.
From that email:
It makes a difference in this example:
in A.java:
class A
{
  static void m() { System.out.print("a"); }
}

in B.java:
class B extends A {}

in C.java:
class C
{
  public static void main(String[] args)
  {
    B.m();
  }
}

Now, recompile B.java:
class B extends A
{
  static void m() { System.out.print("b"); }
}

The result of executing the (unchanged) C.class should now be "b", not
"a".
Comment 4 Andrew Pinski 2003-08-24 00:20:20 UTC
Forgot to menation that I could reproduce the bug on the mainline (20030823).
Comment 5 Tom Tromey 2007-01-09 20:43:52 UTC
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.