This is reduced from the eclipse problem I was seeing.
Compile the following Test.java with gcj --main=Test Test.java

public abstract class Test
{
  public static void main(String[] args) throws Exception
  {
    Class c = Class.forName("Invoke");
    Object o = c.newInstance();
    Test t = (Test) o;
    t.test("FALSE", false);
    t.test("TRUE", true);
  }

  public abstract boolean test(String s, boolean b);
}

Compile the Invoke.java class with gcj -C:

public class Invoke extends Test
{
  public boolean test(String s, boolean b)
  {
    if (b)
      System.out.println(s + ": TRUE!");
    else
      System.out.println(s + ": FALSE!");
    return b;
  }
}

Then run the expected output is:

FALSE: FALSE!
TRUE: TRUE!

But when running ./a.out you will get:

FALSE: TRUE!
TRUE: TRUE!

Running this completely interpreted (gcj -C Test.java; gij Test) produces the
correct output. It also works correctly on powerpc-unknown-linux-gnu (either
partly pre-compiled or fully interpreted).

-- 
           Summary: false boolean argument passed from pre-compiled to
                    interpreted method is true
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at gcc dot gnu dot org
                CC: aph at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org,java-prs at gcc dot gnu dot org,tromey at redhat dot
                    com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21115

Reply via email to