public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran, committed] Fixed one issue with -fcoarray=lib
@ 2014-06-23 17:09 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2014-06-23 17:09 UTC (permalink / raw)
  To: gcc-patches, gfortran

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

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

[-- Attachment #2: caf.diff --]
[-- Type: text/x-patch, Size: 1453 bytes --]

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" } }
+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-23 17:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23 17:09 [Patch, Fortran, committed] Fixed one issue with -fcoarray=lib Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).