PR218.java 433 Bytes
Newer Older
Bryce McKinlay committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// Bug in gcj 20000427: Java executables can abort trying to access a null 
// pointer in a leaf function.

public class PR218
{
  private int i = 5;
  
  public static void main(String[] args)
  {
    try
    {
      new PR218().foo(null);
    }
    catch (NullPointerException x)
    {
      System.out.println(x);
    }
  }
  
  void foo(PR218 e)
  {
    e.i += 4;
  };
}

// Expected output:
//
// java.lang.NullPointerException