diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2024-10-31 15:35:47 +0100 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2024-12-22 16:28:29 +0100 |
commit | 91d52f87c5bc48eacaf305d515e7cce192c2cf9c (patch) | |
tree | 38e504e8c638e034562bb6602f5fba0c9ad3c67d /gcc/fortran/trans-expr.cc | |
parent | d9d92b1c1b418dc5f8298cd75f8bdd5b0bfa9837 (diff) | |
download | gcc-91d52f87c5bc48eacaf305d515e7cce192c2cf9c.zip gcc-91d52f87c5bc48eacaf305d515e7cce192c2cf9c.tar.gz gcc-91d52f87c5bc48eacaf305d515e7cce192c2cf9c.tar.bz2 |
Fortran: Remove adding and removing of caf_get. [PR107635]
Preparatory work for PR107635.
During resolve prevent adding caf_get calls for expressions on the
left-hand-side of an assignment and removing them later on again.
Furthermore has the caf_token in a component become a pointer to
the component and not the backend_decl of the caf-component.
In some cases the caf_token was added as last component in a derived
type and not as the next one following the component that it was
needed to be associated to.
gcc/fortran/ChangeLog:
PR fortran/107635
* gfortran.h (gfc_comp_caf_token): Convenient macro for
accessing caf_token's tree.
* resolve.cc (gfc_resolve_ref): Backup caf_lhs when resolving
expr in array_ref.
(remove_caf_get_intrinsic): Removed.
(resolve_variable): Set flag caf_lhs when resolving lhs of
assignment to prevent insertion of caf_get.
(resolve_lock_unlock_event): Same, but the lhs is the parameter.
(resolve_ordinary_assign): Move conversion to caf_send to
resolve_codes.
(resolve_codes): Adress caf_get and caf_send here.
(resolve_fl_derived0): Set component's caf_token when token is
necessary.
* trans-array.cc (gfc_conv_array_parameter): Get a coarray for
expression that have a corank.
(structure_alloc_comps): Use macro to get caf_token's tree.
(gfc_alloc_allocatable_for_assignment): Same.
* trans-expr.cc (gfc_get_ultimate_alloc_ptr_comps_caf_token):
Same.
(gfc_trans_structure_assign): Same.
* trans-intrinsic.cc (conv_expr_ref_to_caf_ref): Same.
(has_ref_after_cafref): New function to figure that after a
reference of a coarray another reference is present.
(conv_caf_send): Get rhs from correct place, when caf_get is
not removed.
* trans-types.cc (gfc_get_derived_type): Get caf_token from
component and no longer guessing.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
-rw-r--r-- | gcc/fortran/trans-expr.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index e3a4f59..34891af 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -167,7 +167,10 @@ gfc_get_ultimate_alloc_ptr_comps_caf_token (gfc_se *outerse, gfc_expr *expr) if (last_caf_ref == NULL) return NULL_TREE; - tree comp = last_caf_ref->u.c.component->caf_token, caf; + tree comp = last_caf_ref->u.c.component->caf_token + ? gfc_comp_caf_token (last_caf_ref->u.c.component) + : NULL_TREE, + caf; gfc_se se; bool comp_ref = !last_caf_ref->u.c.component->attr.dimension; if (comp == NULL_TREE && comp_ref) @@ -9917,10 +9920,12 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray) if (cm->ts.type == BT_CLASS) field = gfc_class_data_get (field); - token = is_array ? gfc_conv_descriptor_token (field) - : fold_build3_loc (input_location, COMPONENT_REF, - TREE_TYPE (cm->caf_token), dest, - cm->caf_token, NULL_TREE); + token + = is_array + ? gfc_conv_descriptor_token (field) + : fold_build3_loc (input_location, COMPONENT_REF, + TREE_TYPE (gfc_comp_caf_token (cm)), dest, + gfc_comp_caf_token (cm), NULL_TREE); if (is_array) { |