This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java/9861: method name mangling ignores return type


>Number:         9861
>Category:       java
>Synopsis:       method name mangling ignores return type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 26 13:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     sf at b-i-t dot de
>Release:        gcc-3.2.1
>Organization:
>Environment:
gentoo linux 1.4
gcc version 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)
GNU assembler version 2.13.90.0.18 (i586-pc-linux-gnu) using BFD version 2.13.90.0.18 20030121
>Description:
The following Generic Java code was compiled to the two classes which can be found in the attachment.

// TestGJ.java begins here

class Test<Type> {

  protected Type x () {
    return null;
  }
}

public class TestGJ extends Test<Integer> {

  protected Integer x () {
    return new Integer (1);
  }

  public static void main (final String[] argv) {
    new TestGJ ().x ().intValue ();
  }
}

// TestGJ.java ends here

If you execute "java TestGJ" (adjust CLASSPATH as necessary) the program runs without error (BTW, there is no output).

But compilation of the class files with gcj fails because of a name clash during assembly.
>How-To-Repeat:
If you execute

gcj -classpath /usr/share/gcc-data/i586-pc-linux-gnu/3.2/java/libgcj-3.2.1.jar:. Test.class TestGJ.class 

you should get output similar to

/tmp/cc5J7vu9.s: Assembler messages:
/tmp/cc5J7vu9.s:150: Error: symbol `_ZN6TestGJ1xEv' is already defined
>Fix:
The mangled name of a method must contain the method's return type, as in the definition of a method descriptor in the Java Virtual Machine Specification.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-zip-compressed; name="TestGJ.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="TestGJ.zip"

UEsDBBQAAgAIACtvWi4xD4R7xwAAACYBAAAKAAAAVGVzdC5jbGFzc21PzQ7BYBCcrdIf/4kHcGwJ
7oiLhEQkDhr3qi9Nm6aEEt6Kk8TBA3gosV85YZPNTHZmJ7uP5+2ODFqomgwlDWUNFUKuH8RBMiBk
LHtBUIfrlSDQkVCz7GnoHtxO5MZ+Z7YMhZf0CMY88GM32W/Zplu245w2gsfNviTd343BvxBzvt5v
PTEKIk7JO2KXjCdt6StARZbPkCNC5XsVdSh8vSyFm73gF5hVGYkx27iCLqlBhQadbVIufWSFzqlm
pAEm95vlUUix+AJQSwMEFAACAAgAK29aLvdFNsQ6AQAA6QEAAAwAAABUZXN0R0ouY2xhc3NtkN1K
AkEUx/+jq+uuW2apfdiXd2tQPoDiTVAYQheGIV1tNmwjNsI2Rr1V3Sgk9AA9VHTOKpTUXJwzM+f3
P1+fX+8fSOIYFRcZlGxsukhgy8a2Cws7bMr8s2tjTyDdUFqZpkDSr3YFrNPRnRQQzwJFv9oeBE9B
bRjosNbSRoYyqhPyECgtUPJvfoU7JlI6rHOKwpLu8nYg+4ZkTudFm3tpVJ/vKtSBGUdUqty+ko+m
8U+pJqnczmgc9eWZGhKaZfL84oRRDw5cgfwfGQf2aa45G2MePKx4OMAhdc//5PwW95pR2nSD4VjG
87dQoeVkwMeCYCnZLL3y5AX51NEU4m0BUNJFuEj75rAzQ6JnTZF8jREHq8gtkDJtnJHcDFZvitQE
6Qns659cawQslyJknicf2wTWY7uBQuyL31BLAQIXAxQAAgAIACtvWi4xD4R7xwAAACYBAAAKAAAA
AAAAAAAAAACkgQAAAABUZXN0LmNsYXNzUEsBAhcDFAACAAgAK29aLvdFNsQ6AQAA6QEAAAwAAAAA
AAAAAAAAAKSB7wAAAFRlc3RHSi5jbGFzc1BLBQYAAAAAAgACAHIAAABTAgAAAAA=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]