gcj/218: Java executables can abort trying to access a null pointer in a leaf function

bryce@albatross.co.nz bryce@albatross.co.nz
Fri Apr 28 00:16:00 GMT 2000


>Number:         218
>Category:       gcj
>Synopsis:       Java executables can abort trying to access a null pointer in a leaf function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 28 00:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
Recent versions of the compiler optimize out exception 
handling data for leaf functions, assuming that an exception
can never be thrown. However, this is not true for Java
where we map SEGV and SIGFPE into exceptions.
Even with the PR gcj/2 fix applied, the following test 
case will fail.
>How-To-Repeat:
Try to run this:

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

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Java-prs mailing list