OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [io_constraints_3.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! Test some restrictions on the specifiers of OPEN and CLOSE statements.
2
! Contributed by Francois-Xavier Coudert (coudert@clipper.ens.fr)
3
!
4
! { dg-do compile }
5
! { dg-options "-ffree-line-length-none -pedantic -fmax-errors=50" }
6
  integer,parameter :: mone = -1, zero = 0
7
  character(len=*),parameter :: foo = "foo"
8
  character(len=20) :: str
9
  integer :: u
10
 
11
! Test for warnings, when IOSTAT is used
12
 
13
  open(10, iostat=u,access="sequential   ")
14
  open(10, iostat=u,access="sequential   u") ! { dg-warning "ACCESS specifier in OPEN statement" }
15
  open(10, iostat=u,access=foo) ! { dg-warning "ACCESS specifier in OPEN statement" }
16
  open(10, iostat=u,access="direct")
17
  open(10, iostat=u,access="stream")
18
  open(10, iostat=u,access="append") ! { dg-warning "Extension: ACCESS specifier in OPEN statement" }
19
 
20
  open(10, iostat=u,action="read")
21
  open(10, iostat=u,action="write")
22
  open(10, iostat=u,action="readwrite")
23
  open(10, iostat=u,action=foo) ! { dg-warning "ACTION specifier in OPEN statement" }
24
 
25
  open(10, iostat=u,blank="ZERO")
26
  open(10, iostat=u,blank="nUlL")
27
  open(10, iostat=u,blank="NULLL") ! { dg-warning "BLANK specifier in OPEN statement" }
28
 
29
  open(10, iostat=u,delim="apostrophe")
30
  open(10, iostat=u,delim="quote")
31
  open(10, iostat=u,delim="none")
32
  open(10, iostat=u,delim="") ! { dg-warning "DELIM specifier in OPEN statement" }
33
 
34
  open(10, iostat=u,form="formatted")
35
  open(10, iostat=u,form="unformatted")
36
  open(10, iostat=u,form="default") ! { dg-warning "FORM specifier in OPEN statement" }
37
 
38
  open(10, iostat=u,pad="yes")
39
  open(10, iostat=u,pad="no")
40
  open(10, iostat=u,pad=foo) ! { dg-warning "PAD specifier in OPEN statement" }
41
 
42
  open(10, iostat=u,position="asis")
43
  open(10, iostat=u,position="rewind")
44
  open(10, iostat=u,position="append")
45
  open(10, iostat=u,position=foo) ! { dg-warning "POSITION specifier in OPEN statement" }
46
 
47
  open(10, iostat=u,recl="ee") ! { dg-error "must be of type INTEGER" }
48
  open(10, iostat=u,recl=0.4) ! { dg-error "must be of type INTEGER" }
49
  open(10, iostat=u,recl=zero) ! { dg-warning "must be positive" }
50
  open(10, iostat=u,recl=mone) ! { dg-warning "must be positive" }
51
 
52
  open(10, iostat=u,status="unknown")
53
  open(10, iostat=u,status="old")
54
  open(10, iostat=u,status=foo) ! { dg-warning "STATUS specifier in OPEN statement" }
55
 
56
  open(10, iostat=u,status="new") ! { dg-warning "no FILE specifier is present" }
57
  open(10, iostat=u,status="replace   ") ! { dg-warning "no FILE specifier is present" }
58
  open(10, iostat=u,status="scratch",file=str) ! { dg-warning "cannot have the value SCRATCH if a FILE specifier is present" }
59
 
60
  open(10, iostat=u,form="unformatted",delim="none") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
61
  open(10, iostat=u,form="unformatted",pad="yes") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
62
  open(10, iostat=u,form="unformatted",blank="null") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
63
 
64
  open(10, iostat=u,access="direct",position="append") ! { dg-warning "only allowed for stream or sequential ACCESS" }
65
 
66
  close(10, iostat=u,status="keep")
67
  close(10, iostat=u,status="delete")
68
  close(10, iostat=u,status=foo) ! { dg-warning "STATUS specifier in CLOSE statement" }
69
  close(iostat=u) ! { dg-error "requires a UNIT number" }
70
 
71
 
72
 
73
! Test for warnings, when an ERR label is specified
74
 
75
  open(10, err=99,access="sequential   ")
76
  open(10, err=99,access="sequential   u") ! { dg-warning "ACCESS specifier in OPEN statement" }
77
  open(10, err=99,access=foo) ! { dg-warning "ACCESS specifier in OPEN statement" }
78
  open(10, err=99,access="direct")
79
  open(10, err=99,access="stream")
80
  open(10, err=99,access="append") ! { dg-warning "Extension: ACCESS specifier in OPEN statement" }
81
 
82
  open(10, err=99,action="read")
83
  open(10, err=99,action="write")
84
  open(10, err=99,action="readwrite")
85
  open(10, err=99,action=foo) ! { dg-warning "ACTION specifier in OPEN statement" }
86
 
87
  open(10, err=99,blank="ZERO")
88
  open(10, err=99,blank="nUlL")
89
  open(10, err=99,blank="NULLL") ! { dg-warning "BLANK specifier in OPEN statement" }
90
 
91
  open(10, err=99,delim="apostrophe")
92
  open(10, err=99,delim="quote")
93
  open(10, err=99,delim="none")
94
  open(10, err=99,delim="") ! { dg-warning "DELIM specifier in OPEN statement" }
95
 
96
  open(10, err=99,form="formatted")
97
  open(10, err=99,form="unformatted")
98
  open(10, err=99,form="default") ! { dg-warning "FORM specifier in OPEN statement" }
99
 
100
  open(10, err=99,pad="yes")
101
  open(10, err=99,pad="no")
102
  open(10, err=99,pad=foo) ! { dg-warning "PAD specifier in OPEN statement" }
103
 
104
  open(10, err=99,position="asis")
105
  open(10, err=99,position="rewind")
106
  open(10, err=99,position="append")
107
  open(10, err=99,position=foo) ! { dg-warning "POSITION specifier in OPEN statement" }
108
 
109
  open(10, err=99,recl="ee") ! { dg-error "must be of type INTEGER" }
110
  open(10, err=99,recl=0.4) ! { dg-error "must be of type INTEGER" }
111
  open(10, err=99,recl=zero) ! { dg-warning "must be positive" }
112
  open(10, err=99,recl=mone) ! { dg-warning "must be positive" }
113
 
114
  open(10, err=99,status="unknown")
115
  open(10, err=99,status="old")
116
  open(10, err=99,status=foo) ! { dg-warning "STATUS specifier in OPEN statement" }
117
 
118
  open(10, err=99,status="new") ! { dg-warning "no FILE specifier is present" }
119
  open(10, err=99,status="replace   ") ! { dg-warning "no FILE specifier is present" }
120
  open(10, err=99,status="scratch",file=str) ! { dg-warning "cannot have the value SCRATCH if a FILE specifier is present" }
121
 
122
  open(10, err=99,form="unformatted",delim="none") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
123
  open(10, err=99,form="unformatted",pad="yes") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
124
  open(10, err=99,form="unformatted",blank="null") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
125
 
126
  open(10, err=99,access="direct",position="append") ! { dg-warning "only allowed for stream or sequential ACCESS" }
127
 
128
  close(10, err=99,status="keep")
129
  close(10, err=99,status="delete")
130
  close(10, err=99,status=foo) ! { dg-warning "STATUS specifier in CLOSE statement" }
131
 
132
 99 continue
133
 
134
! Test for errors
135
 
136
  open(10,access="sequential   ")
137
  open(10,access="sequential   u") ! { dg-error "ACCESS specifier in OPEN statement" }
138
  open(10,access=foo) ! { dg-error "ACCESS specifier in OPEN statement" }
139
  open(10,access="direct")
140
  open(10,access="stream")
141
  open(10,access="append") ! { dg-warning "Extension: ACCESS specifier in OPEN statement" }
142
 
143
  open(10,action="read")
144
  open(10,action="write")
145
  open(10,action="readwrite")
146
  open(10,action=foo) ! { dg-error "ACTION specifier in OPEN statement" }
147
 
148
  open(10,blank="ZERO")
149
  open(10,blank="nUlL")
150
  open(10,blank="NULLL") ! { dg-error "BLANK specifier in OPEN statement" }
151
 
152
  open(10,delim="apostrophe")
153
  open(10,delim="quote")
154
  open(10,delim="none")
155
  open(10,delim="") ! { dg-error "DELIM specifier in OPEN statement" }
156
 
157
  open(10,form="formatted")
158
  open(10,form="unformatted")
159
  open(10,form="default") ! { dg-error "FORM specifier in OPEN statement" }
160
 
161
  open(10,pad="yes")
162
  open(10,pad="no")
163
  open(10,pad=foo) ! { dg-error "PAD specifier in OPEN statement" }
164
 
165
  open(10,position="asis")
166
  open(10,position="rewind")
167
  open(10,position="append")
168
  open(10,position=foo) ! { dg-error "POSITION specifier in OPEN statement" }
169
 
170
  open(10,recl="ee") ! { dg-error "must be of type INTEGER" }
171
  open(10,recl=0.4) ! { dg-error "must be of type INTEGER" }
172
  open(10,recl=zero) ! { dg-error "must be positive" }
173
  open(10,recl=mone) ! { dg-error "must be positive" }
174
 
175
  open(10,status="unknown")
176
  open(10,status="old")
177
  open(10,status=foo) ! { dg-error "STATUS specifier in OPEN statement" }
178
 
179
  open(10,status="new") ! { dg-error "no FILE specifier is present" }
180
  open(10,status="replace   ") ! { dg-error "no FILE specifier is present" }
181
  open(10,status="scratch",file=str) ! { dg-error "cannot have the value SCRATCH if a FILE specifier is present" }
182
 
183
  open(10,form="unformatted",delim="none") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
184
  open(10,form="unformatted",pad="yes") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
185
  open(10,form="unformatted",blank="null") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
186
 
187
  open(10,access="direct",position="append") ! { dg-error "only allowed for stream or sequential ACCESS" }
188
 
189
  close(10,status="keep")
190
  close(10,status="delete")
191
  close(10,status=foo) ! { dg-error "STATUS specifier in CLOSE statement" }
192
end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.