https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122787

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2026-02-12

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
This can be reproduced using a bash script:
------------------------------------------
#!/bin/bash

# Execute ./a.out 100 times
for i in {1..100}
do
    echo "Execution $i of 100"
    ./a.out

done

echo "All 100 executions completed!"
----------------------------------------
The test case is:

! { dg-do run }
!
! LOCK/UNLOCK check
!
! PR fortran/18918
!

use iso_fortran_env
implicit none

type(lock_type) :: lock[*]
integer :: stat
logical :: acquired

LOCK(lock)
UNLOCK(lock)

stat = 99
LOCK(lock, stat=stat)
if (stat /= 0) STOP 1
stat = 99
UNLOCK(lock, stat=stat)
if (stat /= 0) STOP 2
!sync all
if (this_image() == 1) then
  acquired = .false.
  LOCK (lock[this_image()], acquired_lock=acquired)
  if (.not. acquired) STOP 3
  UNLOCK (lock[1])
end if
end

Uncomment the sync all and no failures.
  • [Bug fortran/122787] [caf_shmem]... jvdelisle at gcc dot gnu.org via Gcc-bugs

Reply via email to