This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Pointer Plus Patch
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: "Andrew Pinski" <pinskia at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org, "Fortran List" <fortran at gcc dot gnu dot org>
- Date: Thu, 14 Jun 2007 10:26:55 +0100
- Subject: Re: Pointer Plus Patch
- References: <de8d50360706130147x75373c0eie94f95eb7964769a@mail.gmail.com>
Andrew Pinski writes:
> Index: java/expr.c
> ===================================================================
> *** java/expr.c (.../trunk/gcc) (revision 125658)
> --- java/expr.c (.../branches/pointer_plus/gcc) (revision 125672)
> *************** build_java_arrayaccess (tree array, tree
> *** 929,941 ****
>
> /* Multiply the index by the size of an element to obtain a byte
> offset. Convert the result to a pointer to the element type. */
> ! index = fold_convert (TREE_TYPE (node),
> ! build2 (MULT_EXPR, sizetype,
> ! fold_convert (sizetype, index),
> ! size_exp));
>
> /* Sum the byte offset and the address of the data field. */
> ! node = fold_build2 (PLUS_EXPR, TREE_TYPE (node), node, index);
>
> /* Finally, return
>
> --- 929,940 ----
>
> /* Multiply the index by the size of an element to obtain a byte
> offset. Convert the result to a pointer to the element type. */
This comment is wrong. You've changed the code but not the comment
that describes it.
> ! index = build2 (MULT_EXPR, sizetype,
> ! fold_convert (sizetype, index),
> ! size_exp);
>
> /* Sum the byte offset and the address of the data field. */
> ! node = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (node), node, index);
>
> /* Finally, return
>
Otherwise OK for Java.
Andrew.