bug: extra four bytes between super/sub instance images, CNI not aware

Adam Megacz gcj@lists.megacz.com
Fri Apr 19 18:18:00 GMT 2002


Can somebody confirm that this is a bug? The program below prints out
"0" rather than "3". Closer inspection reveals that foo() is looking
at a memory location four bytes less than wher y is. This behavior
occurs on both Win32 and Linux.
 - a
cat > test.java <<\EOF
abstract class sup {
 long a;
 boolean b;
 public sup() { }
}
public class test {
 public static void main(String[] s) { new inner(); }
 static class inner extends sup {
 int y = 3;
 native void foo();
 inner() { foo(); }
 }
}
EOF
cat > test.cc <<\EOF
#include "test$inner.h"
#include "java/lang/System.h"
#include "java/io/PrintStream.h"
void test$inner::foo() {
 java::lang::System::out->println(y);
}
EOF
jikes test.java
gcjh test\$inner
gcjh sup
CLASSPATH= gcj -I. test.cc test.java -fno-rtti --main=test
./a.out
-- 
The web is dead; long live the Internet.
http://www.xwt.org/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /