1 ! { dg-do run { target { ! { *-*-mingw* *-*-cygwin* spu-*-* } } } }
2 ! PR30005 Enhanced error messages for OPEN
3 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 ! See PR38956. Test fails on cygwin when user has Administrator rights
6 character(25) :: n
= "temptestfile"
8 inquire(file
=n
, exist
=there
)
10 open(77,file
=n
,status
="new")
11 close(77, status
="keep")
14 open(77,file
=n
,status
="new", iomsg
=msg
, iostat
=i
)
15 if (i
== 0) call abort()
16 if (msg
/= "File 'temptestfile' already exists") call abort()
18 open(77,file
=n
,status
="old")
19 close(77, status
="delete")
20 open(77,file
=n
,status
="old", iomsg
=msg
, iostat
=i
)
21 if (i
== 0) call abort()
22 if (msg
/= "File 'temptestfile' does not exist") call abort()
24 open(77,file
="./", iomsg
=msg
, iostat
=i
)
25 if (msg
/= "'./' is a directory" .and
. msg
/= "Invalid argument") call abort()
27 open(77,file
=n
,status
="new")
29 if (i
== 0 .and
. getuid() /= 0) then
30 close(77, status
="keep")
31 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="write")
32 if (i
== 0) call abort()
33 if (msg
/= "Permission denied trying to open file 'temptestfile'") call abort()
37 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="read")
38 close(77, status
="delete")