public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Rolf W. Rasmussen" <rolfwr@ii.uib.no>
To: java-discuss@sourceware.cygnus.com
Subject: Some null pointer method invocations causes segmentation fault
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <20000328005223.A21555@apal.ii.uib.no> (raw)
Message-ID: <20000401000000.gV2DhbxesPuL5BXUgimivzWBSSnbRzVmpZGburZGRXY@z> (raw)

The following program causes a segmentation fault when run, instead of
the NullPointerException one would expect.

--------
public class NullPointerExceptionTest {
    public static void main(String[] args) {
        ((Integer) null).intValue();
    }
}
--------

Starting
program: /home/debian/rolfwr/prg/testgcj/./NullPointerExceptionTest

[...]
Program received signal SIGSEGV, Segmentation fault.
0x400dfef9 in java.lang.Integer.intValue (this=null)
    at ../../../libjava/java/lang/Integer.java:60
60          return value;
Current language:  auto; currently java
(gdb) bt
#0  0x400dfef9 in java.lang.Integer.intValue (this=null)
    at ../../../libjava/java/lang/Integer.java:60
#1  0x804af63 in NullPointerExceptionTest.main (args=@8081ff0)
    at NullPointerExceptionTest.java:3
#2  0x4013160a in gnu::gcj::runtime::FirstThread::run (this=@8064ea0)
[...]

Other one-liners that trigger the same problem:

    ((String) null).length();
    ((java.util.Vector) null).size();
    Boolean ref = null; ref.booleanValue();

I've compiled/run with gcj/libgcj pulled from CVS on 27. March.
gcc version 2.96 20000327 (experimental) on i586-pc-linux-gnu

--
Rolf W. Rasmussen

             reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-27 14:52 Rolf W. Rasmussen [this message]
2000-03-27 16:21 ` Bryce McKinlay
2000-03-28  1:00   ` Andrew Haley
2000-03-28 19:14     ` PR libgcj/184 [was Re: Re: Some null pointer method invocations causes segmentation fault] Bryce McKinlay
2000-03-30  3:06       ` Bryce McKinlay
2000-04-01  0:00         ` Bryce McKinlay
2000-04-01  0:00       ` Bryce McKinlay
2000-04-01  0:00     ` Some null pointer method invocations causes segmentation fault Andrew Haley
2000-04-01  0:00   ` Bryce McKinlay
2000-04-01  0:00 ` Rolf W. Rasmussen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000328005223.A21555@apal.ii.uib.no \
    --to=rolfwr@ii.uib.no \
    --cc=java-discuss@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).