https://gcc.gnu.org/g:63851c77785af1e51c56a5614d324a02430de382

commit r17-1506-g63851c77785af1e51c56a5614d324a02430de382
Author: Lipeng Zhu <[email protected]>
Date:   Fri Jun 12 10:40:39 2026 +0200

    libgomp.fortran/rwlock_1.f90: Ensure unique file name with many threads 
[PR113005]
    
    libgomp/ChangeLog:
    
            PR testsuite/113005
            * testsuite/libgomp.fortran/rwlock_1.f90: Enlarge buffer size of
            'file_name' handling 5 instead of 3 digit I/O unit numbers.

Diff:
---
 libgomp/testsuite/libgomp.fortran/rwlock_1.f90 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libgomp/testsuite/libgomp.fortran/rwlock_1.f90 
b/libgomp/testsuite/libgomp.fortran/rwlock_1.f90
index f90ecbeb00f7..1c271ae031d0 100644
--- a/libgomp/testsuite/libgomp.fortran/rwlock_1.f90
+++ b/libgomp/testsuite/libgomp.fortran/rwlock_1.f90
@@ -7,13 +7,12 @@ program main
   use omp_lib
   implicit none
   integer:: unit_number, v1, v2, i
-  character(11) :: file_name
+  character(16) :: file_name
   character(3) :: async = "no"
   !$omp parallel private (unit_number, v1, v2, file_name, async, i)
     do i = 0, 100
       unit_number = 10 + omp_get_thread_num ()
-      write (file_name, "(I3, A)") unit_number, "_tst.dat"
-      file_name = adjustl(file_name)
+      write (file_name, "(I5.5, A)") unit_number, "_tst.dat"
       open (unit_number, file=file_name, asynchronous="yes")
       ! call inquire with file parameter to test find_file in unix.c
       inquire (file=file_name, asynchronous=async)

Reply via email to