Bug with arrays or type conversion?
Bryce McKinlay
bryce@albatross.co.nz
Sun Nov 21 21:24:00 GMT 1999
Matt Welsh wrote:
> Bryce McKinlay <bryce@albatross.co.nz> writes:
> > What version of gcc are you using? Using 2.95.2 it works fine for me with -O2
> > or -O3. I suspect its a generic or back-end optimization bug in the particul
> > ar snapshor you're using.
>
> I am actually using egcs 2.95.2 on x86 Linux (Redhat 6.0).
OK. I just noticed that this only manifests itself when you're compiling bytecode -> native.
It actually works fine for source -> native. It doesn't seem to be affected by optimization
however - the bytecode->native result is allways wrong, but different depending on the -O
setting used.
[bryce@reason putshort]$ gcj -O3 PutShort.java -o putshort --main=PutShort
[bryce@reason putshort]$ ./putshort
0x0 0x0 0x0 0x1 0x0 0x2 0x0 0x3 0x0 0x4 0x0 0x5 0x0 0x6 0x0 0x7 0x0 0x8 0x0 0x9 0x0 0xa 0x0
0xb 0x0 0xc 0x0 0xd 0x0 0xe 0x0 0xf 0x0 0x10 0x0 0x11 0x0 0x12 0x0 0x13 0x0 0x14 0x0 0x15 0x0
0x16 0x0 0x17 0x0 0x18 0x0 0x19 0x0 0x1a 0x0 0x1b 0x0 0x1c 0x0 0x1d 0x0 0x1e 0x0 0x1f 0x0
0x20 0x0 0x21 0x0 0x22 0x0 0x23 0x0 0x24 0x0 0x25 0x0 0x26 0x0 0x27 0x0 0x28 0x0 0x29 0x0
0x2a 0x0 0x2b 0x0 0x2c 0x0 0x2d 0x0 0x2e 0x0 0x2f 0x0 0x30 0x0 0x31
(ok)
[bryce@reason putshort]$ jikes *.java
[bryce@reason putshort]$ java PutShort
0x0 0x0 0x0 0x1 0x0 0x2 0x0 0x3 0x0 0x4 0x0 0x5 0x0 0x6 0x0 0x7 0x0 0x8 0x0 0x9 0x0 0xa 0x0
0xb 0x0 0xc 0x0 0xd 0x0 0xe 0x0 0xf 0x0 0x10 0x0 0x11 0x0 0x12 0x0 0x13 0x0 0x14 0x0 0x15 0x0
0x16 0x0 0x17 0x0 0x18 0x0 0x19 0x0 0x1a 0x0 0x1b 0x0 0x1c 0x0 0x1d 0x0 0x1e 0x0 0x1f 0x0
0x20 0x0 0x21 0x0 0x22 0x0 0x23 0x0 0x24 0x0 0x25 0x0 0x26 0x0 0x27 0x0 0x28 0x0 0x29 0x0
0x2a 0x0 0x2b 0x0 0x2c 0x0 0x2d 0x0 0x2e 0x0 0x2f 0x0 0x30 0x0 0x31
(ok)
[bryce@reason putshort]$ gcj PutShort.class -o putshort --main=PutShort
[bryce@reason putshort]$ ./putshort
0x37 0x20 0x0 0x9 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
Wrong!
regards
[ bryce ]
More information about the Java
mailing list