This is the mail archive of the 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]

Desparately need help: Was: GCJ Bug accessing field of inner class (gcc version 2.97 20010117)

Apparently I've done something wrong in building gcj, but I can't figure out the problem is.  I'd greatly appreciate any suggestions (this is driving me crazy).

A simple helloworld program compiles and runs correctly, but a test program involving inner classes fails on execution.  My test classes and output are below.

Mark Wielaard did run this test sucessfully, using gcc version 2.97 20010117, which is same build I'm using.  So presumably I'm doing something wrong.

I'm running Linux 2.2.14 (SuSE 6.4) on ix86 hardware.  I removed all the old gcj 2.95 libraries and programs.  My binutils are 2.10.91 (via CSV).  Here's the procedure I followed to build gcc and gcj

- checked out a full copy of the gcc
- hacked the so that libgcj gets built.
- configured in a separate, empty directory (not in  the CVS tree), using

/usr/local/gcc_cvs/gcc/configure --prefix=/usr/local/gcc --enable-languages=c++,java
- Deleted everything in /usr/local/gcc
- Ran make and make install.  In other words, I built a completely new version of the full gcc

I do still have a copy of gcc-2.95.2-19 on my system, but my $PATH=/usr/local/gcc/bin: ..., so I when I invoke gcj, the new version of the gcc should be invoked. (gcc -v -> Gcc Version 2.97 20010117). $LD_LIBRARY_PATH starts with /usr/local/gcc/lib (and I've checked all lib directories for stray libgcj libraries).

Has anyone else tried this under Linux?



package A;

public class HasInnerClass {

    InnerClass ic0;

    public HasInnerClass() {
        ic0 = new InnerClass();
        System.err.println("In HasInnerClass(), ic0.s = " + ic0.s);

    public class InnerClass {
        String s;
        int i;

        public InnerClass() {
            s = "A stringggggggggggggggggggggggggggggggggggggggg";
            i = 123;

    public InnerClass newInnerClass() { return( new InnerClass() ); }

package A;

public class UsesInnerClass {

    public UsesInnerClass() {

        HasInnerClass hic = new HasInnerClass();
        System.err.println( "In UsesInnerClass(), hic.ic0.s = " + hic.ic0.s);

    public static void main(String[] argv) { new UsesInnerClass(); }

After compiling with gcj, gcc version 2.97 20010117 (experimental),  running  it yields

In HasInnerClass(), ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
Out of Memory!  Returning NIL!
instead of
In HasInnerClass(), ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
In UsesInnerClass(), hic.ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
Is this a known bug?


Barnet Wagman

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