gcj/214: Compiler generates incorrect array initialization code
jsturm@sigma6.com
jsturm@sigma6.com
Sat Apr 22 14:16:00 GMT 2000
>Number: 214
>Category: gcj
>Synopsis: Compiler generates incorrect array initialization code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Apr 22 14:16:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Jeff Sturm
>Release: CVS
>Organization:
>Environment:
alphapca56-unknown-linux-gnu
>Description:
The attached class prints the wrong output when compiled
from Java source to native code. The code that
initializes the int array seems to be shifted by four
octets.
Compiling first to bytecode and then native does not exhibit
the problem.
(Is there any good reason static arrays are initialized
at runtime instead of generating an initialized data
object?)
>How-To-Repeat:
[jsturm@cc42593-a tmp]$ gcj StaticArray.java --main=StaticArray -o staticarray
[jsturm@cc42593-a tmp]$ ./staticarray
2
3
4
0
(Expected output is 1,2,3,4)
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="StaticArray.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="StaticArray.java"
cHVibGljIGNsYXNzIFN0YXRpY0FycmF5IHsKICAgIHN0YXRpYyBpbnQgdGFibGVbXSA9IHsxLCAy
LCAzLCA0fTsKCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAg
ICAgICAgZm9yIChpbnQgbiA9IDA7IG4gPCB0YWJsZS5sZW5ndGg7IG4rKykKICAgICAgICAgICAg
U3lzdGVtLm91dC5wcmludGxuKChpbnQpdGFibGVbbl0pOwogICAgfQp9Cg==
More information about the Java-prs
mailing list