From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23671 invoked by alias); 10 Aug 2011 15:11:27 -0000 Received: (qmail 23653 invoked by uid 22791); 10 Aug 2011 15:11:26 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Aug 2011 15:11:12 +0000 Received: by gxk3 with SMTP id 3so79543gxk.20 for ; Wed, 10 Aug 2011 08:11:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.147.14.1 with SMTP id r1mr7337769yai.3.1312989071258; Wed, 10 Aug 2011 08:11:11 -0700 (PDT) Received: by 10.147.82.10 with HTTP; Wed, 10 Aug 2011 08:11:07 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Aug 2011 15:59:00 -0000 Message-ID: Subject: Re: [PATCH] [JAVA] Double.parseDouble(null) throw NullPointerException From: Jie Liu To: Tom Tromey Cc: java-patches@gcc.gnu.org, gcc-patches@gcc.gnu.org, Joel Sherrill Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2011-q3/txt/msg00051.txt.bz2 2011/8/10 Tom Tromey : >>>>>> "Jie" =3D=3D Jie Liu 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 va= lue. > > If you compile the Java parts of the library with -fcheck-references, it > should work. =A0This 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- configure.host (revision 172224) +++ configure.host (working copy) @@ -347,8 +347,14 @@ slow_pthread_self=3D can_unwind_signal=3Dyes ;; + *-*-rtems*) + can_unwind_signal=3Dno + CHECKREFSPEC=3D-fcheck-references + DIVIDESPEC=3D-fuse-divide-subroutine + ;; esac + case "${host}" in *-cygwin* | *-mingw*) fallback_backtrace_h=3Dsysdep/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=3DHelloWorld.java -fhash-synchronization -fuse-divide-subroutine -fcheck-references -fuse-boehm-gc -fkeep-inline-functions -quiet -dumpbase HelloWorld.java -mtune=3Di386 -march=3Di386 -auxbase HelloWorld -g -g -Wall -version -fsaw-java-file -fbootclasspath=3D./:/usr/share/java/ecj.jar:/mnt/gcj/mytoolchain/share/jav= a/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. =A0IIRC 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. =A0I believe Andrew had a g++ > patch to do this in the compiler, but it was rejected. > > Tom >