diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2017-01-07 18:26:58 +0100 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2017-01-07 18:26:58 +0100 |
commit | de91486c745d5ff6aff491cb9bd1a78875bf090c (patch) | |
tree | f294640f3f31fa5e09df6b9587e7dd3cbfd62c4c /gcc/fortran/primary.c | |
parent | 0fc08a17f0b750eeca8bae85eca0d944e4da130e (diff) | |
download | gcc-de91486c745d5ff6aff491cb9bd1a78875bf090c.zip gcc-de91486c745d5ff6aff491cb9bd1a78875bf090c.tar.gz gcc-de91486c745d5ff6aff491cb9bd1a78875bf090c.tar.bz2 |
re PR fortran/78781 ([Coarray] ICE in gfc_deallocate_scalar_with_status, at fortran/trans.c:1588)
gcc/fortran/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78781
PR fortran/78935
* expr.c (gfc_check_pointer_assign): Return the same error message for
rewritten coarray pointer assignments like for plain ones.
* gfortran.h: Change prototype.
* primary.c (caf_variable_attr): Set attributes used ones only only
ones. Add setting of pointer_comp attribute.
(gfc_caf_attr): Add setting of pointer_comp attribute.
* trans-array.c (gfc_array_allocate): Add flag that the component to
allocate is not an ultimate coarray component. Add allocation of
pointer arrays.
(structure_alloc_comps): Extend nullify to treat pointer components in
coarrays correctly. Restructure nullify to remove redundant code.
(gfc_nullify_alloc_comp): Allow setting caf_mode flags.
* trans-array.h: Change prototype of gfc_nullify_alloc_comp ().
* trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for
derived type coarrays with pointer components.
* trans-expr.c (gfc_trans_structure_assign): Also treat pointer
components.
(trans_caf_token_assign): Handle assignment of token of scalar pointer
components.
(gfc_trans_pointer_assignment): Call above routine.
* trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer
components.
(gfc_conv_intrinsic_caf_get): Likewise.
(conv_caf_send): Likewise.
* trans-stmt.c (gfc_trans_allocate): After allocating a derived type in
a coarray pre-register the tokens.
(gfc_trans_deallocate): Simply determining the coarray type (scalar or
array) and deregistering it correctly.
* trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the
actual codim to allow lookup of array types in the cache.
(gfc_build_array_type): Likewise.
(gfc_get_array_descriptor_base): Likewise.
(gfc_get_array_type_bounds): Likewise.
(gfc_get_derived_type): Likewise.
* trans-types.h: Likewise.
* trans.c (gfc_deallocate_with_status): Enable deregistering of all kind
of coarray components.
(gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode
instead of caf_deregister.
libgfortran/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78781
PR fortran/78935
* caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar
destination components.
gcc/testsuite/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray/ptr_comp_1.f08: New test.
* gfortran.dg/coarray/ptr_comp_2.f08: New test.
* gfortran.dg/coarray/ptr_comp_3.f08: New test.
* gfortran.dg/coarray/ptr_comp_4.f08: New test.
* gfortran.dg/coarray_ptr_comp_1.f08: New test.
* gfortran.dg/coarray_ptr_comp_2.f08: New test.
* gfortran.dg/coarray_ptr_comp_3.f08: New test.
From-SVN: r244196
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 25a2829..d62f6bb 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2436,8 +2436,7 @@ gfc_expr_attr (gfc_expr *e) static symbol_attribute caf_variable_attr (gfc_expr *expr, bool in_allocate, bool *refs_comp) { - int dimension, codimension, pointer, allocatable, target, coarray_comp, - alloc_comp; + int dimension, codimension, pointer, allocatable, target, coarray_comp; symbol_attribute attr; gfc_ref *ref; gfc_symbol *sym; @@ -2458,7 +2457,8 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate, bool *refs_comp) codimension = CLASS_DATA (sym)->attr.codimension; pointer = CLASS_DATA (sym)->attr.class_pointer; allocatable = CLASS_DATA (sym)->attr.allocatable; - alloc_comp = CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp; + attr.alloc_comp = CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp; + attr.pointer_comp = CLASS_DATA (sym)->ts.u.derived->attr.pointer_comp; } else { @@ -2466,8 +2466,10 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate, bool *refs_comp) codimension = sym->attr.codimension; pointer = sym->attr.pointer; allocatable = sym->attr.allocatable; - alloc_comp = sym->ts.type == BT_DERIVED + attr.alloc_comp = sym->ts.type == BT_DERIVED ? sym->ts.u.derived->attr.alloc_comp : 0; + attr.pointer_comp = sym->ts.type == BT_DERIVED + ? sym->ts.u.derived->attr.pointer_comp : 0; } target = coarray_comp = 0; @@ -2545,7 +2547,6 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate, bool *refs_comp) attr.target = target; attr.save = sym->attr.save; attr.coarray_comp = coarray_comp; - attr.alloc_comp = alloc_comp; return attr; } @@ -2575,6 +2576,8 @@ gfc_caf_attr (gfc_expr *e, bool in_allocate, bool *refs_comp) attr.pointer = CLASS_DATA (sym)->attr.class_pointer; attr.allocatable = CLASS_DATA (sym)->attr.allocatable; attr.alloc_comp = CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp; + attr.pointer_comp = CLASS_DATA (sym)->ts.u.derived + ->attr.pointer_comp; } } else if (e->symtree) |