arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_io_1.f90
blob58daf30a8990fa00f0c5a083f616946677b158a3
1 ! { dg-do run { target fd_truncate } }
2 ! { dg-options "-fdec" }
4 ! Run-time tests for values of DEC I/O parameters (doesn't test functionality).
7 subroutine check_cc (fd, cc)
8 implicit none
9 character(*), intent(in) :: cc
10 integer, intent(in) :: fd
11 character(20) :: cc_inq
12 inquire(unit=fd, carriagecontrol=cc_inq)
13 if (cc_inq .ne. cc) then
14 print *, '(', fd, ') cc expected ', cc, ' was ', cc_inq
15 STOP 1
16 endif
17 endsubroutine
19 subroutine check_share (fd, share)
20 implicit none
21 character(*), intent(in) :: share
22 integer, intent(in) :: fd
23 character(20) :: share_inq
24 inquire(unit=fd, share=share_inq)
25 if (share_inq .ne. share) then
26 print *, '(', fd, ') share expected ', share, ' was ', share_inq
27 STOP 2
28 endif
29 endsubroutine
31 subroutine check_action (fd, acc)
32 implicit none
33 character(*), intent(in) :: acc
34 integer, intent(in) :: fd
35 character(20) acc_inq
36 inquire(unit=fd, action=acc_inq)
37 if (acc_inq .ne. acc) then
38 print *, '(', fd, ') access expected ', acc, ' was ', acc_inq
39 STOP 3
40 endif
41 endsubroutine
43 implicit none
45 integer, parameter :: fd=3
46 character(*), parameter :: fname = 'dec_io_1.txt'
48 !!!! <default>
50 open(unit=fd, file=fname, action='WRITE')
51 call check_cc(fd, 'LIST')
52 call check_share(fd, 'NODENY')
53 write (fd,*) 'test'
54 close(unit=fd)
56 !!!! READONLY
58 open (unit=fd, file=fname, readonly)
59 call check_action(fd, 'READ')
60 close (unit=fd)
62 !!!! SHARED / SHARE='DENYNONE'
64 open (unit=fd, file=fname, action='read', shared)
65 call check_share(fd, 'DENYNONE')
66 close (unit=fd)
68 open (unit=fd, file=fname, action='read', share='DENYNONE')
69 call check_share(fd, 'DENYNONE')
70 close (unit=fd)
72 !!!! NOSHARED / SHARE='DENYRW'
74 open (unit=fd, file=fname, action='write', noshared)
75 call check_share(fd, 'DENYRW')
76 close (unit=fd)
78 open (unit=fd, file=fname, action='write', share='DENYRW')
79 call check_share(fd, 'DENYRW')
80 close (unit=fd)
82 !!!! CC=FORTRAN
84 open(unit=fd, file=fname, action ='WRITE', carriagecontrol='FORTRAN')
85 call check_cc(fd, 'FORTRAN')
86 close(unit=fd)
88 !!!! CC=LIST
90 open(unit=fd, file=fname, action ='WRITE', carriagecontrol='LIST')
91 call check_cc(fd, 'LIST')
92 close(unit=fd)
94 !!!! CC=NONE
96 open(unit=fd, file=fname, action ='WRITE', carriagecontrol='NONE')
97 call check_cc(fd, 'NONE')
98 close(unit=fd, status='delete') ! cleanup temp file