From 2b0fbfde1f8a23a3c638c2ec0b7ab08b30988722 Mon Sep 17 00:00:00 2001 From: burnus Date: Mon, 22 Jul 2013 17:28:56 +0000 Subject: [PATCH] 2013-07-22 Tobias Burnus PR fortran/57906 PR fortran/52052 * class.c (gfc_build_class_symbol): Set coarray_comp. * trans-array.c (structure_alloc_comps): For coarrays, directly use the data pointer address. 2013-07-22 Tobias Burnus PR fortran/57906 PR fortran/52052 * coarray/lib_realloc_1.f90: Permit optimization. * gfortran.dg/coarray_31.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201140 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/class.c | 1 + gcc/fortran/trans-array.c | 17 +++++++++++++---- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gfortran.dg/coarray/lib_realloc_1.f90 | 1 - 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4ea5d2ee99d..c531d039993 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2013-07-22 Tobias Burnus + + PR fortran/57906 + PR fortran/52052 + * class.c (gfc_build_class_symbol): Set coarray_comp. + * trans-array.c (structure_alloc_comps): For coarrays, + directly use the data pointer address. + 2013-07-22 Chang * trans-decl.c (gfc_build_dummy_array_decl): Exit loop after diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index ba8efa91114..51bfd5685ea 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -666,6 +666,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr, fclass->attr.extension = ts->u.derived->attr.extension + 1; fclass->attr.alloc_comp = ts->u.derived->attr.alloc_comp; + fclass->attr.coarray_comp = ts->u.derived->attr.coarray_comp; } fclass->attr.is_class = 1; diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 3fdd8d9ab01..0aac6789f80 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -7589,9 +7589,9 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, if ((c->ts.type == BT_DERIVED && !c->attr.pointer) || (c->ts.type == BT_CLASS && !CLASS_DATA (c)->attr.class_pointer)) - { - comp = fold_build3_loc (input_location, COMPONENT_REF, ctype, - decl, cdecl, NULL_TREE); + { + comp = fold_build3_loc (input_location, COMPONENT_REF, ctype, + decl, cdecl, NULL_TREE); /* The finalizer frees allocatable components. */ called_dealloc_with_status @@ -7737,8 +7737,17 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, cdecl, NULL_TREE); dcmp = fold_build3_loc (input_location, COMPONENT_REF, ctype, dest, cdecl, NULL_TREE); + if (c->attr.codimension) - gfc_add_modify (&fnblock, dcmp, comp); + { + if (c->ts.type == BT_CLASS) + { + comp = gfc_class_data_get (comp); + dcmp = gfc_class_data_get (dcmp); + } + gfc_conv_descriptor_data_set (&fnblock, dcmp, + gfc_conv_descriptor_data_get (comp)); + } else { tmp = structure_alloc_comps (c->ts.u.derived, comp, dcmp, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b167b2a891..97f52c9f1ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2013-07-22 Tobias Burnus + PR fortran/57906 + PR fortran/52052 + * coarray/lib_realloc_1.f90: Permit optimization. + * gfortran.dg/coarray_31.f90: New. + +2013-07-22 Tobias Burnus + PR fortran/57762 * gfortran.dg/class_array_7.f03: Fix memory leak. diff --git a/gcc/testsuite/gfortran.dg/coarray/lib_realloc_1.f90 b/gcc/testsuite/gfortran.dg/coarray/lib_realloc_1.f90 index ed906f5a134..f3d7f35f271 100644 --- a/gcc/testsuite/gfortran.dg/coarray/lib_realloc_1.f90 +++ b/gcc/testsuite/gfortran.dg/coarray/lib_realloc_1.f90 @@ -1,5 +1,4 @@ ! { dg-do run } -! { dg-options "-O0" } ! ! Test that for CAF components _gfortran_caf_deregister is called ! Test that norealloc happens for CAF components during assignment -- 2.11.4.GIT