diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 17 | ||||
-rw-r--r-- | gcc/fortran/trans.c | 4 |
5 files changed, 24 insertions, 17 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5d8cc6476c1..b3019f3571e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2011-07-19 Richard Guenther <rguenther@suse.de> + + * trans-expr.c (fill_with_spaces): Use fold_build_pointer_plus. + (gfc_trans_string_copy): Likewise. + * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Likewise. + * trans-types.c (gfc_get_array_descr_info): Likewise. + * trans.c (gfc_build_array_ref): Likewise. + 2011-07-19 Janus Weil <janus@gcc.gnu.org> PR fortran/49708 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 55a0fc499df..26d43980ff9 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3790,8 +3790,8 @@ fill_with_spaces (tree start, tree type, tree size) fold_build2_loc (input_location, MINUS_EXPR, sizetype, i, TYPE_SIZE_UNIT (type))); gfc_add_modify (&loop, el, - fold_build2_loc (input_location, POINTER_PLUS_EXPR, - TREE_TYPE (el), el, TYPE_SIZE_UNIT (type))); + fold_build_pointer_plus_loc (input_location, + el, TYPE_SIZE_UNIT (type))); /* Making the loop... actually loop! */ tmp = gfc_finish_block (&loop); @@ -3917,8 +3917,7 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest, built_in_decls[BUILT_IN_MEMMOVE], 3, dest, src, slen); - tmp4 = fold_build2_loc (input_location, POINTER_PLUS_EXPR, TREE_TYPE (dest), - dest, fold_convert (sizetype, slen)); + tmp4 = fold_build_pointer_plus_loc (input_location, dest, slen); tmp4 = fill_with_spaces (tmp4, chartype, fold_build2_loc (input_location, MINUS_EXPR, TREE_TYPE(dlen), dlen, slen)); diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index db2bbc14770..0c8abc6ca0d 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -5998,9 +5998,8 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) fold_convert (gfc_charlen_type_node, count)); tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_charlen_type_node, tmp, fold_convert (gfc_charlen_type_node, size)); - tmp = fold_build2_loc (input_location, POINTER_PLUS_EXPR, pvoid_type_node, - fold_convert (pvoid_type_node, dest), - fold_convert (sizetype, tmp)); + tmp = fold_build_pointer_plus_loc (input_location, + fold_convert (pvoid_type_node, dest), tmp); tmp = build_call_expr_loc (input_location, built_in_decls[BUILT_IN_MEMMOVE], 3, tmp, src, fold_build2_loc (input_location, MULT_EXPR, diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index d7f1dd51683..01587eb5f2b 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2899,7 +2899,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info) t = base_decl; if (!integer_zerop (data_off)) - t = build2 (POINTER_PLUS_EXPR, ptype, t, data_off); + t = fold_build_pointer_plus (t, data_off); t = build1 (NOP_EXPR, build_pointer_type (ptr_type_node), t); info->data_location = build1 (INDIRECT_REF, ptr_type_node, t); if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE) @@ -2912,12 +2912,14 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info) for (dim = 0; dim < rank; dim++) { - t = build2 (POINTER_PLUS_EXPR, ptype, base_decl, - size_binop (PLUS_EXPR, dim_off, lower_suboff)); + t = fold_build_pointer_plus (base_decl, + size_binop (PLUS_EXPR, + dim_off, lower_suboff)); t = build1 (INDIRECT_REF, gfc_array_index_type, t); info->dimen[dim].lower_bound = t; - t = build2 (POINTER_PLUS_EXPR, ptype, base_decl, - size_binop (PLUS_EXPR, dim_off, upper_suboff)); + t = fold_build_pointer_plus (base_decl, + size_binop (PLUS_EXPR, + dim_off, upper_suboff)); t = build1 (INDIRECT_REF, gfc_array_index_type, t); info->dimen[dim].upper_bound = t; if (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_SHAPE @@ -2936,8 +2938,9 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info) info->dimen[dim].lower_bound, info->dimen[dim].upper_bound); } - t = build2 (POINTER_PLUS_EXPR, ptype, base_decl, - size_binop (PLUS_EXPR, dim_off, stride_suboff)); + t = fold_build_pointer_plus (base_decl, + size_binop (PLUS_EXPR, + dim_off, stride_suboff)); t = build1 (INDIRECT_REF, gfc_array_index_type, t); t = build2 (MULT_EXPR, gfc_array_index_type, t, elem_size); info->dimen[dim].stride = t; diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 4043df287f1..578f2258247 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -345,9 +345,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl) gfc_array_index_type, offset, GFC_DECL_SPAN(decl)); tmp = gfc_build_addr_expr (pvoid_type_node, base); - tmp = fold_build2_loc (input_location, POINTER_PLUS_EXPR, - pvoid_type_node, tmp, - fold_convert (sizetype, offset)); + tmp = fold_build_pointer_plus_loc (input_location, tmp, offset); tmp = fold_convert (build_pointer_type (type), tmp); if (!TYPE_STRING_FLAG (type)) tmp = build_fold_indirect_ref_loc (input_location, tmp); |