This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [re] Java executables can abort trying to access a null pointer in a leaf function


tsuraan wrote:
Does this thing use DWARF based exception handling?


I'm not sure what that means, but it looks like FreeBSD since 3.x have
used DWARF.  I'm on x86, so it's pretty standard hardware.


If so my guess would be a problem with MAKE_THROW_FRAME on this platfrom.

If making the first statement of foo something other than dereferencing
the null pointer (like increment a static int) fixes the problem then I
would be even more confident about this.

David Daney.



Changing the code to:

public class NullPointer
{
  private int i = 5;
  private static int j = 10;

  public static void main(String[] args)
  {
    try
    {
      new NullPointer().foo(null);
    }
    catch (NullPointerException x)
    {
      System.out.println(x);
    }
  }

  void foo(NullPointer e)
  {
    NullPointer.j += 5;
    e.i += 4;
  };
}

and (from Bryce's suggestion) changing the compile line to:

/opt/gcc-4.1/bin/gcj -fnon-call-exceptions -o nullpointer
NullPointer.java --main=NullPointer

Assuming that's what was desired, running the program still results in
"Abort trap (core dumped)".

Look at the bright side here. At least you have a core file. Now you can load this thing into gdb and get a stacktrace.


David Daney


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]