From f549bfb3db5524f71d1d29f4a3adc99ffcebfd87 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Mon, 1 Jan 2018 17:36:41 +0000 Subject: re PR fortran/83076 (ICE in gfc_deallocate_scalar_with_status, at fortran/trans.c:1598) 2018-01-01 Paul Thomas PR fortran/83076 * resolve.c (resolve_fl_derived0): Add caf_token fields for allocatable and pointer scalars, when -fcoarray selected. * trans-types.c (gfc_copy_dt_decls_ifequal): Copy the token field as well as the backend_decl. (gfc_get_derived_type): Flag GFC_FCOARRAY_LIB for module derived types that are not vtypes. Components with caf_token attribute are pvoid types. For a component requiring it, find the caf_token field and have the component token field point to its backend_decl. PR fortran/83319 *trans-types.c (gfc_get_array_descriptor_base): Add the token field to the descriptor even when codimen not set. 2018-01-01 Paul Thomas PR fortran/83076 * gfortran.dg/coarray_45.f90 : New test. PR fortran/83319 * gfortran.dg/coarray_46.f90 : New test. From-SVN: r256065 --- gcc/fortran/resolve.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index cf75a78..c1d8a42 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13993,6 +13993,31 @@ resolve_fl_derived0 (gfc_symbol *sym) if (!success) return false; + /* Now add the caf token field, where needed. */ + if (flag_coarray != GFC_FCOARRAY_NONE + && !sym->attr.is_class && !sym->attr.vtype) + { + for (c = sym->components; c; c = c->next) + if (!c->attr.dimension && !c->attr.codimension + && (c->attr.allocatable || c->attr.pointer)) + { + char name[GFC_MAX_SYMBOL_LEN+9]; + gfc_component *token; + sprintf (name, "_caf_%s", c->name); + token = gfc_find_component (sym, name, true, true, NULL); + if (token == NULL) + { + if (!gfc_add_component (sym, name, &token)) + return false; + token->ts.type = BT_VOID; + token->ts.kind = gfc_default_integer_kind; + token->attr.access = ACCESS_PRIVATE; + token->attr.artificial = 1; + token->attr.caf_token = 1; + } + } + } + check_defined_assignments (sym); if (!sym->attr.defined_assign_comp && super_type) -- cgit v1.1