coarray_41.f90: Add "-latomic" option if libatomic_available.
[official-gcc.git] / gcc / testsuite / gfortran.dg / chmod_3.f90
blob5df752844a86cd4a3aba3f7fec10301f8b0c44a0
1 ! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
2 ! { dg-options "-std=gnu -fdefault-integer-8" }
3 ! See PR38956. Test fails on cygwin when user has Administrator rights
4 implicit none
5 character(len=*), parameter :: n = "foobar_file_chmod_3"
6 integer :: i
8 open (10,file=n)
9 close (10,status="delete")
11 open (10,file=n)
12 close (10,status="keep")
14 if (access(n,"") /= 0 .or. access(n," ") /= 0 .or. access(n,"r") /= 0 .or. &
15 access(n,"R") /= 0 .or. access(n,"w") /= 0 .or. access(n,"W") /= 0) &
16 call abort
18 i = chmod (n, "a+x")
19 if (i == 0) then
20 if (access(n,"x") /= 0 .or. access(n,"X") /= 0) call abort
21 end if
23 i = chmod (n, "a-w")
24 if (i == 0 .and. getuid() /= 0) then
25 if (access(n,"w") == 0 .or. access(n,"W") == 0) call abort
26 end if
28 open (10,file=n)
29 close (10,status="delete")
31 if (access(n,"") == 0 .or. access(n," ") == 0 .or. access(n,"r") == 0 .or. &
32 access(n,"R") == 0 .or. access(n,"w") == 0 .or. access(n,"W") == 0) &
33 call abort
35 end