[PATCH 17/22] Coarray caf_shmem final patch set

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Ref: https://gcc.gnu.org/pipermail/fortran/2026-February/063551.html

See attached.

Awaiting approval.
caf_shmem-17-of-22.patch (text/x-patch, 1.6 KB)
From e9bf5e7e8aa91067e97ba900523607293af5d0aa Mon Sep 17 00:00:00 2001
From: Jerry DeLisle <[email protected]>
Date: Sun, 15 Feb 2026 15:17:17 -0800
Subject: [PATCH] Fortran: Add new testcase for PR121360

This test case is from the PR adjusted to reduce the execution
time and includes 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/coarray/lock_3.f90: New test.
---
 gcc/testsuite/gfortran.dg/coarray/lock_3.f90 | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/gfortran.dg/coarray/lock_3.f90

diff --git a/gcc/testsuite/gfortran.dg/coarray/lock_3.f90 b/gcc/testsuite/gfortran.dg/coarray/lock_3.f90
new file mode 100644
index 00000000000..44d55a97841
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/lock_3.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+! Test case from PR121360
+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
+
-- 
2.53.0
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.