Re: [PATCH 11/13] Coarray shared memory library

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
On 2/11/26 1:48 AM, Tobias Burnus wrote:
> Jerry D wrote:
>>      Fortran: Fix coarray assignment when rhs is complicated.
>>      gcc/fortran/ChangeLog:
>>              * resolve.cc: Introduce temporary holding rhs when lhs is a
>>              coarray expresssion.
> 
> Likewise: It would be good if there could be a testcase for this.
> 
> Tobias
> 

Attached please find the requested testcase with a new commit to be applied
after the approvaal of the complete patch set.

Author: Jerry DeLisle <[email protected]>
Date:   Sat Feb 14 16:59:56 2026 -0800

     Fortran: Add new testcase for PR121360

     This test case is from the PR adjusted to reduce the execution
     time and included a suitable test condition. It was tested with
     export GFORTRAN_NUM_IMAGES=200 which of course takes a bit of
     time.

             PR fortran/121360

     gcc/testsuite/ChangeLog:

             * gfortran.dg/lock_3.f90: New test.

OK when the time comes for mainline?

Jerry
PR121360-test.diff (text/x-patch, 1.3 KB)
commit e74e83d268e7ecadb018368c6a9b7730d172d085
Author: Jerry DeLisle <[email protected]>
Date:   Sat Feb 14 16:59:56 2026 -0800

    Fortran: Add new testcase for PR121360
    
    This test case is from the PR adjusted to reduce the execution
    time and included a suitable test condition. It was tested with
    export GFORTRAN_NUM_IMAGES=200 which of course takes a bit of
    time.
    
            PR fortran/121360
    
    gcc/testsuite/ChangeLog:
    
            * gfortran.dg/lock_3.f90: New test.

diff --git a/gcc/testsuite/gfortran.dg/lock_3.f90 b/gcc/testsuite/gfortran.dg/lock_3.f90
new file mode 100644
index 00000000000..77b8f828bc2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lock_3.f90
@@ -0,0 +1,22 @@
+program memain
+   use, intrinsic :: iso_fortran_env, only : lock_type
+   type(lock_type), codimension[*] :: lck
+   integer, codimension[*] :: count
+   integer :: i, j, s
+   do j=4,5  ! To be adjusted, dunno how long this runs
+     if (this_image() == 1) count = 0
+     sync all
+     do i=1,10**j
+        lock (lck[1])
+        count[1] = count[1] + 1
+        unlock (lck[1])
+     end do
+     sync all
+     if (this_image() == 1) then
+        !print *,"Expected: ",10**j*num_images(), "Found: ", count[1]
+        if (count[1] .ne. 10**j*num_images()) stop 1
+     end if
+     sync all
+   end do
+end program
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.