This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran, committed] Fixed one issue with -fcoarray=lib
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Mon, 23 Jun 2014 19:09:21 +0200
- Subject: [Patch, Fortran, committed] Fixed one issue with -fcoarray=lib
- Authentication-results: sourceware.org; auth=none
The issue fixed by the attached test case was that an automatic array
wasn't properly initialized with -fcoarray=lib. As the code is for
explicit-size arrays, it isn't reachable for allocatable coarrays. On
the other hand, for coarrays with SAVE attribute, already the condition
before should be triggered:
else if (sym->attr.codimension && TREE_STATIC (sym->backend_decl))
Thus, removing the condition for good should be fine. (Alternatively,
one could add an "|| !sym->attr.codimension".)
Build and regtested on x86-64-gnu-linux.
Committed as Rev. 211907.
Tobias
gcc/fortran/
2014-06-23 Tobias Burnus <burnus@net-b.de>
* trans-decl.c (gfc_trans_deferred_vars): Fix handling of
explicit-size arrays with -fcoarray=lib.
gcc/testsuite/
2014-06-23 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray_32.f90: New.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index f1a18c3..291dd1f 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3870,7 +3870,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
NULL_TREE);
continue;
}
- else if (gfc_option.coarray != GFC_FCOARRAY_LIB)
+ else
{
gfc_save_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
diff --git a/gcc/testsuite/gfortran.dg/coarray_32.f90 b/gcc/testsuite/gfortran.dg/coarray_32.f90
new file mode 100644
index 0000000..8e6dc54
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_32.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original -fcoarray=lib" }
+!
+ real, allocatable :: values(:)[:]
+ allocate(values(1024)[*])
+ call laplacian(values)
+contains
+ subroutine laplacian(rhs)
+ real, allocatable :: rhs(:)[:]
+ real :: local_laplacian(size(rhs))
+ local_laplacian=0.
+ end subroutine
+end
+
+! { dg-final { scan-tree-dump-times "ubound.. = " 1 "original" } }
+! { dg-final { scan-tree-dump-times "size.. = " 2 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
+