This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Widen field offset


A thinko of mine in the Java front end.

A question: when I add a pointer and an integer, I need to widen the
integer to be the same size as the pointer.  Is it correct to do this
by converting the integer to another pointer of the same type, or must
I convert the integer to an integer type of the same size as a
pointer?

Andrew.


2004-01-28  Andrew Haley  <aph@redhat.com>

	* expr.c (build_field_ref): Widen field offset.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.181
diff -c -2 -p -r1.181 expr.c
*** expr.c	9 Jan 2004 19:55:12 -0000	1.181
--- expr.c	28 Jan 2004 15:09:15 -0000
*************** build_field_ref (tree self_value, tree s
*** 1524,1527 ****
--- 1543,1547 ----
  	    build (ARRAY_REF, integer_type_node, TYPE_OTABLE_DECL (output_class), 
  		   otable_index);
+ 	  field_offset = fold (convert (ptr_type_node, field_offset));
  	  tree address 
  	    = fold (build (PLUS_EXPR, 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]