diff options
| author | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-16 09:17:49 +0000 |
|---|---|---|
| committer | pault <pault@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-16 09:17:49 +0000 |
| commit | 1033248c1aee0c38d5f37d1df79e0139a1d79e8e (patch) | |
| tree | 0671456d4a0001c3c76dbc6dc8b6b3c8d5ac9a80 /gcc/fortran/trans-stmt.c | |
| parent | 6a8fd95b693441373a689ad47e305d412e865351 (diff) | |
| download | ppe42-gcc-1033248c1aee0c38d5f37d1df79e0139a1d79e8e.tar.gz ppe42-gcc-1033248c1aee0c38d5f37d1df79e0139a1d79e8e.zip | |
2007-09-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29396
PR fortran/29606
PR fortran/30625
PR fortran/30871
* trans.h : Add extra argument to gfc_build_array_ref. Rename
gfc_conv_aliased_arg to gfc_conv_subref_array_arg. Move
prototype of is_aliased_array to gfortran.h and rename it
gfc_is_subref_array. Add field span to lang_decl, add a new
decl lang specific flag accessed by GFC_DECL_SUBREF_ARRAY_P
and a new type flag GFC_DECL_SUBREF_ARRAY_P.
* trans.c (gfc_build_array_ref): Add the new argument, decl.
If this is a subreference array pointer, use the lang_decl
field 'span' to calculate the offset in bytes and use pointer
arithmetic to address the element.
* trans-array.c (gfc_conv_scalarized_array_ref,
gfc_conv_array_ref): Add the backend declaration as the third
field, if it is likely to be a subreference array pointer.
(gfc_conv_descriptor_dimension, gfc_trans_array_ctor_element,
gfc_trans_array_constructor_element, structure_alloc_comps,
gfc_conv_array_index_offset): For all other references to
gfc_build_array_ref, set the third argument to NULL.
(gfc_get_dataptr_offset): New function.
(gfc_conv_expr_descriptor): If the rhs of a pointer assignment
is a subreference array, then calculate the offset to the
subreference of the first element and set the descriptor data
pointer to this, using gfc_get_dataptr_offset.
trans-expr.c (gfc_get_expr_charlen): Use the expression for the
character length for a character subreference.
(gfc_conv_substring, gfc_conv_subref_array_arg): Add NULL for
third argument in call to gfc_build_array_ref.
(gfc_conv_aliased_arg): Rename to gfc_conv_subref_array_arg.
(is_aliased_array): Remove.
(gfc_conv_function_call): Change reference to is_aliased_array
to gfc_is_subref_array and reference to gfc_conv_aliased_arg to
gfc_conv_subref_array_arg.
(gfc_trans_pointer_assignment): Add the array element length to
the lang_decl 'span' field.
* gfortran.h : Add subref_array_pointer to symbol_attribute and
add the prototype for gfc_is_subref_array.
* trans-stmt.c : Add NULL for third argument in all references
to gfc_build_array_ref.
* expr.c (gfc_is_subref_array): Renamed is_aliased_array.
If this is a subreference array pointer, return true.
(gfc_check_pointer_assign): If the rhs is a subreference array,
set the lhs subreference_array_pointer attribute.
* trans-decl.c (gfc_get_symbol_decl): Allocate the lang_decl
field if the symbol is a subreference array pointer and set an
initial value of zero for the 'span' field.
* trans-io.c (set_internal_unit): Refer to is_subref_array and
gfc_conv_subref_array_arg.
(nml_get_addr_expr): Add NULL third argument to
gfc_build_array_ref.
(gfc_trans_transfer): Use the scalarizer for a subreference
array.
2007-09-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29396
PR fortran/29606
PR fortran/30625
PR fortran/30871
* gfortran.dg/subref_array_pointer_1.f90: New test.
* gfortran.dg/subref_array_pointer_2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-stmt.c')
| -rw-r--r-- | gcc/fortran/trans-stmt.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index f900ec52f4b..0bf0387d950 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -1650,7 +1650,7 @@ gfc_trans_nested_forall_loop (forall_info * nested_forall_info, tree body, /* If a mask was specified make the assignment conditional. */ if (mask) { - tmp = gfc_build_array_ref (mask, maskindex); + tmp = gfc_build_array_ref (mask, maskindex, NULL); body = build3_v (COND_EXPR, tmp, body, build_empty_stmt ()); } } @@ -1729,7 +1729,7 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, gfc_conv_expr (&lse, expr); /* Form the expression for the temporary. */ - tmp = gfc_build_array_ref (tmp1, count1); + tmp = gfc_build_array_ref (tmp1, count1, NULL); /* Use the scalar assignment as is. */ gfc_add_block_to_block (&block, &lse.pre); @@ -1770,7 +1770,7 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Form the expression of the temporary. */ if (lss != gfc_ss_terminator) - rse.expr = gfc_build_array_ref (tmp1, count1); + rse.expr = gfc_build_array_ref (tmp1, count1, NULL); /* Translate expr. */ gfc_conv_expr (&lse, expr); @@ -1781,7 +1781,7 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Form the mask expression according to the mask tree list. */ if (wheremask) { - wheremaskexpr = gfc_build_array_ref (wheremask, count3); + wheremaskexpr = gfc_build_array_ref (wheremask, count3, NULL); if (invert) wheremaskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (wheremaskexpr), @@ -1843,7 +1843,7 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3, { gfc_init_block (&body1); gfc_conv_expr (&rse, expr2); - lse.expr = gfc_build_array_ref (tmp1, count1); + lse.expr = gfc_build_array_ref (tmp1, count1, NULL); } else { @@ -1867,7 +1867,7 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3, gfc_conv_expr (&rse, expr2); /* Form the expression of the temporary. */ - lse.expr = gfc_build_array_ref (tmp1, count1); + lse.expr = gfc_build_array_ref (tmp1, count1, NULL); } /* Use the scalar assignment. */ @@ -1878,7 +1878,7 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3, /* Form the mask expression according to the mask tree list. */ if (wheremask) { - wheremaskexpr = gfc_build_array_ref (wheremask, count3); + wheremaskexpr = gfc_build_array_ref (wheremask, count3, NULL); if (invert) wheremaskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (wheremaskexpr), @@ -2251,7 +2251,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, inner_size, NULL, block, &ptemp1); gfc_start_block (&body); gfc_init_se (&lse, NULL); - lse.expr = gfc_build_array_ref (tmp1, count); + lse.expr = gfc_build_array_ref (tmp1, count, NULL); gfc_init_se (&rse, NULL); rse.want_pointer = 1; gfc_conv_expr (&rse, expr2); @@ -2278,7 +2278,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_start_block (&body); gfc_init_se (&lse, NULL); gfc_init_se (&rse, NULL); - rse.expr = gfc_build_array_ref (tmp1, count); + rse.expr = gfc_build_array_ref (tmp1, count, NULL); lse.want_pointer = 1; gfc_conv_expr (&lse, expr1); gfc_add_block_to_block (&body, &lse.pre); @@ -2320,7 +2320,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, inner_size, NULL, block, &ptemp1); gfc_start_block (&body); gfc_init_se (&lse, NULL); - lse.expr = gfc_build_array_ref (tmp1, count); + lse.expr = gfc_build_array_ref (tmp1, count, NULL); lse.direct_byref = 1; rss = gfc_walk_expr (expr2); gfc_conv_expr_descriptor (&lse, expr2, rss); @@ -2343,7 +2343,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Reset count. */ gfc_add_modify_expr (block, count, gfc_index_zero_node); - parm = gfc_build_array_ref (tmp1, count); + parm = gfc_build_array_ref (tmp1, count, NULL); lss = gfc_walk_expr (expr1); gfc_init_se (&lse, NULL); gfc_conv_expr_descriptor (&lse, expr1, lss); @@ -2596,7 +2596,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) /* Store the mask. */ se.expr = convert (mask_type, se.expr); - tmp = gfc_build_array_ref (mask, maskindex); + tmp = gfc_build_array_ref (mask, maskindex, NULL); gfc_add_modify_expr (&body, tmp, se.expr); /* Advance to the next mask element. */ @@ -2795,7 +2795,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, if (mask && (cmask || pmask)) { - tmp = gfc_build_array_ref (mask, count); + tmp = gfc_build_array_ref (mask, count, NULL); if (invert) tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, tmp); gfc_add_modify_expr (&body1, mtmp, tmp); @@ -2803,7 +2803,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, if (cmask) { - tmp1 = gfc_build_array_ref (cmask, count); + tmp1 = gfc_build_array_ref (cmask, count, NULL); tmp = cond; if (mask) tmp = build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); @@ -2812,7 +2812,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, if (pmask) { - tmp1 = gfc_build_array_ref (pmask, count); + tmp1 = gfc_build_array_ref (pmask, count, NULL); tmp = build1 (TRUTH_NOT_EXPR, mask_type, cond); if (mask) tmp = build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); @@ -2971,7 +2971,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Form the mask expression according to the mask. */ index = count1; - maskexpr = gfc_build_array_ref (mask, index); + maskexpr = gfc_build_array_ref (mask, index, NULL); if (invert) maskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (maskexpr), maskexpr); @@ -3028,7 +3028,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Form the mask expression according to the mask tree list. */ index = count2; - maskexpr = gfc_build_array_ref (mask, index); + maskexpr = gfc_build_array_ref (mask, index, NULL); if (invert) maskexpr = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (maskexpr), maskexpr); |

