https://gcc.gnu.org/g:be98b8c25915aa20e9eb2b25786838b12127ada0
commit r16-7738-gbe98b8c25915aa20e9eb2b25786838b12127ada0 Author: Jerry DeLisle <[email protected]> Date: Sun Feb 15 15:17:17 2026 -0800 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. Diff: --- gcc/testsuite/gfortran.dg/coarray/lock_3.f90 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 000000000000..44d55a978417 --- /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 +
