The following program is rejected with: class(periodic_2nd_order), intent(in) :: this 1 Error: Component '_def_init' at (1) with coarray component shall be a nonpointer, nonallocatable scalar class(periodic_2nd_order), intent(in) :: this 1 Error: Variable 'dst' at (1) is INTENT(OUT) and can thus not be an allocatable coarray or have coarray components class(periodic_2nd_order), intent(in) :: this 1 Error: Component '_def_init' at (1) with coarray component shall be a nonpointer, nonallocatable scalar module periodic_2nd_order_module implicit none type periodic_2nd_order real, allocatable :: global_f(:)[:] contains procedure :: output end type contains subroutine output (this) class(periodic_2nd_order), intent(in) :: this end subroutine end module
Patch for the _def_init issue: --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -11492,6 +11492,7 @@ resolve_fl_derived0 (gfc_symbol *sym) /* F2008, C444. */ if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.coarray_comp + && !sym->attr.vtype && (c->attr.codimension || c->attr.pointer || c->attr.dimension || c->attr.allocatable)) {
Author: burnus Date: Mon Sep 3 06:35:59 2012 New Revision: 190869 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190869 Log: 2012-09-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> Tobias Burnus <burnus@net-b.de> PR fortran/37336 * gfortran.h (symbol_attribute): Add artificial. * module.c (mio_symbol_attribute): Handle attr.artificial * class.c (gfc_build_class_symbol): Defer creation of the vtab if the DT has finalizers, mark generated symbols as attr.artificial. (has_finalizer_component, finalize_component, finalization_scalarizer, generate_finalization_wrapper): New static functions. (gfc_find_derived_vtab): Add _final component and call generate_finalization_wrapper. * dump-parse-tree.c (show_f2k_derived): Use resolved proc_tree->n.sym rather than unresolved proc_sym. (show_attr): Handle attr.artificial. * resolve.c (gfc_resolve_finalizers): Ensure that the vtab * exists. (resolve_fl_derived): Resolve finalizers before generating the vtab. (resolve_symbol): Also allow assumed-rank arrays with CONTIGUOUS; skip artificial symbols. (resolve_fl_derived0): Skip artificial symbols. 2012-09-03 Tobias Burnus <burnus@net-b.de> PR fortran/51632 * gfortran.dg/coarray_class_1.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/coarray_class_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/class.c trunk/gcc/fortran/dump-parse-tree.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/module.c trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Fixed by introducing the "artificial" attribute. TODO: Check that this patch doesn't worsen the handling of (non)polymorphic coarray components of a polymorphic variable are properly handled for DEALLOCATE/ALLOCATE/intrinsic assignment.
> Fixed by introducing the "artificial" attribute. > > TODO: Check that this patch doesn't worsen the handling of (non)polymorphic > coarray components of a polymorphic variable are properly handled for > DEALLOCATE/ALLOCATE/intrinsic assignment. Any hint about how to do that?
> > TODO: Check that this patch doesn't worsen the handling of (non)polymorphic > > coarray components of a polymorphic variable are properly handled for > > DEALLOCATE/ALLOCATE/intrinsic assignment. > > Any hint about how to do that? No feedback, closing as FIXED. Please open new PR(s) with relevant information for remaining issue(s).