diff mbox

[Fortran-caf,committed] Fix array support for CAF send, handle rank > 1 arrays

Message ID 5341AEE7.5000606@net-b.de
State New
Headers show

Commit Message

Tobias Burnus April 6, 2014, 7:45 p.m. UTC
Testing showed that the test case doesn't work with num_images() > 1. 
Fixed by the commit Rev. 209170.

Tobias

Tobias Burnus wrote:
> This patch fixes some stupid bugs I made in the previous commit: 
> lhs_se.descriptor_only will give the descriptor only, i.e. it looses 
> the information about array sections. Additionally, it helps to add 
> lhs_se.pre to the block ;-)
>
> The implementation in single.c also had some problems - and it only 
> supported rank == 1 arrays. The new version handles any rank.
>
> Additionally, I have included a test case to ensure it works with 
> caf/single.c (the test it written such that it should also works with 
> num_images() > 1, but I have not yet tested it).
>
> Committed after regtesting on x86-64-gnu-linux as Rev. 209168.
>
> Tobias
diff mbox

Patch

Index: gcc/testsuite/ChangeLog.fortran-caf
===================================================================
--- gcc/testsuite/ChangeLog.fortran-caf	(Revision 209168)
+++ gcc/testsuite/ChangeLog.fortran-caf	(Arbeitskopie)
@@ -1,3 +1,8 @@ 
 2014-04-06  Tobias Burnus  <burnus@net-b.de>
 
+	* gfortran.dg/coarray/send_array.f90: Fix support
+	for num_images() > 1.
+
+2014-04-06  Tobias Burnus  <burnus@net-b.de>
+
 	* gfortran.dg/coarray/send_array.f90: New.
Index: gcc/testsuite/gfortran.dg/coarray/send_array.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray/send_array.f90	(Revision 209168)
+++ gcc/testsuite/gfortran.dg/coarray/send_array.f90	(Arbeitskopie)
@@ -37,7 +37,7 @@  subroutine one(lb1, lb2)
   a(:,:) = b(lb1, lb2)
   sync all
   if (this_image() == 1) then
-    caf(:,:)[this_image()] = b(lb1, lb2)
+    caf(:,:)[num_images()] = b(lb1, lb2)
   end if
   sync all
   if (this_image() == num_images()) then
@@ -51,7 +51,7 @@  subroutine one(lb1, lb2)
   a(:,:) = b(:, :)
   sync all
   if (this_image() == 1) then
-    caf(:,:)[this_image()] = b(:, :)
+    caf(:,:)[num_images()] = b(:, :)
   end if
   sync all
   if (this_image() == num_images()) then
@@ -74,7 +74,8 @@  subroutine one(lb1, lb2)
                   a(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2) = b(lb1, lb2)
                   sync all
                   if (this_image() == 1) then
-                    caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[1] = b(lb1, lb2)
+                    caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[num_images()] &
+                        = b(lb1, lb2)
                   end if
                   sync all
 
@@ -85,7 +86,7 @@  subroutine one(lb1, lb2)
                       = b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)
                   sync all
                   if (this_image() == 1) then
-                    caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[1] &
+                    caf(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)[num_images()] &
                         = b(i:i_e:i_s*i_sgn1, j:j_e:j_s*i_sgn2)
                   end if
                   sync all