java/6393: alignment problems with jlong and inner class inheritance

adam@xwt.org adam@xwt.org
Sun Apr 21 10:56:00 GMT 2002


>Number:         6393
>Category:       java
>Synopsis:       alignment problems with jlong and inner class inheritance
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 21 07:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     adam@xwt.org
>Release:        unknown-1.0
>Organization:
>Environment:
GCJ-Linux, GCJ-PowerPC, GCJ-Win32
>Description:
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.

[[see how-to-repeat]]
>How-To-Repeat:
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
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list