public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jie Liu <lj8175@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: java-patches@gcc.gnu.org, gcc-patches@gcc.gnu.org,
		Joel Sherrill <joel.sherrill@oarcorp.com>
Subject: Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException
Date: Wed, 10 Aug 2011 15:59:00 -0000	[thread overview]
Message-ID: <CABc96T-R-TY=T0KrnedV0hSyhLoa1=vuc_P9jwJ_gmEz4QjfJg@mail.gmail.com> (raw)
In-Reply-To: <m339hatrqv.fsf@fleche.redhat.com>

2011/8/10 Tom Tromey <tromey@redhat.com>:
>>>>>> "Jie" == Jie Liu <lj8175@gmail.com> writes:
>
> Jie> RTEMS does not have virtual memory management, so there is no error
> Jie> when access the 0 address on rtems.
> Jie> So 'str->length()' donot throw NPE and just return an meaningless value.
>
> If you compile the Java parts of the library with -fcheck-references, it
> should work.  This is something you have to set up as part of the port,
> as it is decided at (libgcj-) configure time.
>
Thank you very much for the information you provide. :)

I add the following patch for -fcheck-references:
Index: configure.host
===================================================================
--- configure.host	(revision 172224)
+++ configure.host	(working copy)
@@ -347,8 +347,14 @@
 	slow_pthread_self=
 	can_unwind_signal=yes
 	;;
+  *-*-rtems*)
+	can_unwind_signal=no
+	CHECKREFSPEC=-fcheck-references
+	DIVIDESPEC=-fuse-divide-subroutine
+	;;
 esac

+
 case "${host}" in
   *-cygwin* | *-mingw*)
 	fallback_backtrace_h=sysdep/i386/backtrace.h

And we can see the following have -fcheck-references:
/mnt/gcj/mytoolchain/libexec/gcc/i386-rtems/4.7.0/jc1
/tmp/ccYuDgD5.jar -fsource-filename=HelloWorld.java
-fhash-synchronization -fuse-divide-subroutine -fcheck-references
-fuse-boehm-gc -fkeep-inline-functions -quiet -dumpbase
HelloWorld.java -mtune=i386 -march=i386 -auxbase HelloWorld -g -g
-Wall -version -fsaw-java-file
-fbootclasspath=./:/usr/share/java/ecj.jar:/mnt/gcj/mytoolchain/share/java/libgcj-4.7.0.jar
-faux-classpath /tmp/cc6nFx0I.zip -o /tmp/ccCuf7ju.s
GNU Java (GCC) version 4.7.0 20110409 (experimental) (i386-rtems)

But it does not work as we want, is there something wrong?

Thanks,
Jie

> This won't help with the native code.  IIRC in the end we just gave up
> on that; if you wanted real correctness you would have to add a null
> check at every dereference in the C++ code.  I believe Andrew had a g++
> patch to do this in the compiler, but it was rejected.
>
> Tom
>

  reply	other threads:[~2011-08-10 15:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABc96T_0THd_tKzdHSjD-xcPd7=dqoFkr0aRwrdvx-h4s2Hnxg@mail.gmail.com>
2011-08-07 11:00 ` Jie Liu
2011-08-08 14:16   ` Tom Tromey
2011-08-09 17:29     ` Jie Liu
2011-08-10 13:34       ` Tom Tromey
2011-08-10 15:59         ` Jie Liu [this message]
2011-08-10 16:41           ` Tom Tromey
2011-08-12  7:39             ` Jie Liu
2011-08-12 16:22               ` Bryce McKinlay
2011-08-12 17:12             ` Jie Liu
2011-08-14 13:04               ` Tom Tromey
2011-08-15 14:07   ` Andrew Haley

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='CABc96T-R-TY=T0KrnedV0hSyhLoa1=vuc_P9jwJ_gmEz4QjfJg@mail.gmail.com' \
    --to=lj8175@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    --cc=joel.sherrill@oarcorp.com \
    --cc=tromey@redhat.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).