This is the mail archive of the java-prs@sourceware.cygnus.com mailing list for the Java project.


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

gcj/162: gcj does not initialize interfaces according to spec



>Number:         162
>Category:       gcj
>Synopsis:       gcj does not initialize interfaces according to spec
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 06 16:16:03 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        gcc version 2.96 20000305 (experimental)
>Organization:
>Environment:
any?
>Description:
Running the interface initialization test from S12.4.1 of 
the Java Language Specification produces incorrect results.
It appears that the compiler does not implement the spec
correctly for interface initialization, emitting calls to
_Jv_Initclass at the wrong times.

The expected output from the test is:
1
j=3
jj=4
3

Output from the gcj-compiled version is:
j=3
jj=4
1
k=5
3

The problems are that:
- gcj generates a _Jv_InitClass call for "J" when J.i is 
accessed, which it shouldn't because J.i is a 
compile-time constant and does not require intialization.
- gcj generates a _Jv_InitClass call for "K" when K.j is 
accessed, which it shouldn't because j is actually defined 
in K's superinterface, J.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="TestInterfaceInit.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="TestInterfaceInit.java"

aW50ZXJmYWNlIEkKewogIGludCBpPTEsIGlpID0gVGVzdC5vdXQoImlpIiwgMik7Cn0KCmludGVy
ZmFjZSBKIGV4dGVuZHMgSQp7CiAgaW50IGogPSBUZXN0Lm91dCgiaiIsIDMpLCBqaiA9IFRlc3Qu
b3V0KCJqaiIsIDQpOwp9CgppbnRlcmZhY2UgSyBleHRlbmRzIEoKewogIGludCBrID0gVGVzdC5v
dXQoImsiLCA1KTsKfQoKcHVibGljIGNsYXNzIFRlc3RJbnRlcmZhY2VJbml0CnsKICBwdWJsaWMg
c3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1tdKQogIHsKICAgIFN5c3RlbS5vdXQucHJpbnRs
bihKLmkpOwogICAgU3lzdGVtLm91dC5wcmludGxuKEsuaik7ICAgIAogIH0KICAKICBzdGF0aWMg
aW50IG91dChTdHJpbmcgcywgaW50IGkpCiAgewogICAgU3lzdGVtLm91dC5wcmludGxuKHMgKyAi
PSIgKyBpKTsKICAgIHJldHVybiBpOwogIH0KfQo=

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