diff options
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r-- | gcc/java/expr.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c index c915a91589f..d446e490abb 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -929,13 +929,12 @@ build_java_arrayaccess (tree array, tree type, tree index) /* 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)); + 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 (PLUS_EXPR, TREE_TYPE (node), node, index); + node = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (node), node, index); /* Finally, return @@ -1744,7 +1743,7 @@ build_field_ref (tree self_value, tree self_class, tree name) field_offset = fold (convert (sizetype, field_offset)); self_value = java_check_reference (self_value, check); address - = fold_build2 (PLUS_EXPR, + = fold_build2 (POINTER_PLUS_EXPR, build_pointer_type (TREE_TYPE (field_decl)), self_value, field_offset); return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address); @@ -2228,8 +2227,8 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, method_index++; } method_index *= int_size_in_bytes (method_type_node); - ref = fold_build2 (PLUS_EXPR, method_ptr_type_node, - ref, build_int_cst (NULL_TREE, method_index)); + ref = fold_build2 (POINTER_PLUS_EXPR, method_ptr_type_node, + ref, size_int (method_index)); ref = build1 (INDIRECT_REF, method_type_node, ref); func = build3 (COMPONENT_REF, nativecode_ptr_type_node, ref, lookup_field (&method_type_node, ncode_ident), @@ -2333,8 +2332,8 @@ build_invokevirtual (tree dtable, tree method, tree special) size_int (TARGET_VTABLE_USES_DESCRIPTORS)); } - func = fold_build2 (PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable, - convert (nativecode_ptr_ptr_type_node, method_index)); + func = fold_build2 (POINTER_PLUS_EXPR, nativecode_ptr_ptr_type_node, dtable, + convert (sizetype, method_index)); if (TARGET_VTABLE_USES_DESCRIPTORS) func = build1 (NOP_EXPR, nativecode_ptr_type_node, func); |