Optimisation bug (?)

Bryce McKinlay bryce@albatross.co.nz
Thu Jun 24 03:36:00 GMT 1999


> So, it looks as though private methods are a bit *too* private when used
>
> with optimisation, or I'm missing something (probably blindingly obvious
> :-)

I can confirm this. It looks like gcj decides that private methods are not
required when using -O3  ;-)

public class Private
{
  private static void sayHi()
  {
    System.out.println("Hi");
  }

  public static void main(String args[])
   {
     Private.sayHi();
   }
}

[bryce@pho-ku tests]$ gcj -O3 Private.java -o private --main=Private
/tmp/cccVaaaa.o: In function `Private::main(JArray<java::lang::String *>
*)':
/tmp/cccVaaaa.o(.text+0x2c): undefined reference to `Private::sayHi(void)'
collect2: ld returned 1 exit status

regards

  [ bryce ]




More information about the Java mailing list