[java, 3.0.1]: BUG: Unresolved symbols with -O3 and higher

Jeff Sturm jsturm@one-point.com
Tue Jul 24 10:22:00 GMT 2001


On Tue, 24 Jul 2001, Manfred Hollstein wrote:
> Funnily, the methods in question are used _and_ defined (in Java source
> code, but obviously not emitted) in the corresponding .java file. Using
> "-O2" (ie. no automatic function inlining) doesn't show this problem.

"-fkeep-inline-functions" should be a viable workaround.

I'll argue this should be the default for gcj, due to reflection.  In fact
the behavior of the program below changes when compiled with/without
-fkeep-inline-functions:

import java.lang.reflect.Method;

public class Junk {
  private void junk() {
    System.out.println("junk");
  }

  public static void main(String[] args) {
    try {
      Junk junk = new Junk();
      Method[] meths = junk.getClass().getDeclaredMethods();
      for (int n = 0; n < meths.length; n++)
        System.out.println(meths[n]);
    } catch (Throwable t) {
      t.printStackTrace();
    }
  }
}




More information about the Gcc-bugs mailing list