This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Don't generate NullPointerExceptions for arraylength and arrayload
- From: Andrew Haley <aph at redhat dot com>
- To: Ranjit Mathew <rmathew at gmail dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 17 Mar 2005 10:28:19 +0000
- Subject: Re: Don't generate NullPointerExceptions for arraylength and arrayload
- References: <16952.32557.528504.580543@cuddles.cambridge.redhat.com><423933DB.8050104@gmail.com>
Ranjit Mathew writes:
> Andrew Haley wrote:
> > This removes the special case code that throws a NullPointerException
> > bease on the type of an arrayref. This trick no longer works because
> > in the bytecode front end we now use the same variable decl for every
> > object. In ancy case, this optimization just provided a fast path to
> > throw a NullPointerException.
> >
> > This is a regression from 3.x.
>
> [...]
>
> > - if (type == ptr_type_node)
> > - return build3 (CALL_EXPR, int_type_node,
> > - build_address_of (soft_nullpointer_node),
> > - NULL_TREE, NULL_TREE);
> > -
>
> Doesn't doing this make "Array_3 -O3 bytecode -> native"
> fail for you?
No. We already discussed this in
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00465.html.
I already answered this question in
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00746.html
It's possible that the code I removed in this latest patch was
papering over the real bug, and so Array_3 triggers now where it
didn't before.
I'm interested to know whether people think we should make these loads
volatile.
Andrew.