Pointer Plus Patch

Andrew Haley aph-gcc@littlepinkcloud.COM
Thu Jun 14 15:15:00 GMT 2007


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.



More information about the Java-patches mailing list