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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [io_constraints_3.f90] - Blame information for rev 193

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 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-warning "must be of type INTEGER" }
48
  open(10, iostat=u,recl=0.4) ! { dg-warning "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
 
70
 
71
 
72
! Test for warnings, when an ERR label is specified
73
 
74
  open(10, err=99,access="sequential   ")
75
  open(10, err=99,access="sequential   u") ! { dg-warning "ACCESS specifier in OPEN statement" }
76
  open(10, err=99,access=foo) ! { dg-warning "ACCESS specifier in OPEN statement" }
77
  open(10, err=99,access="direct")
78
  open(10, err=99,access="stream")
79
  open(10, err=99,access="append") ! { dg-warning "Extension: ACCESS specifier in OPEN statement" }
80
 
81
  open(10, err=99,action="read")
82
  open(10, err=99,action="write")
83
  open(10, err=99,action="readwrite")
84
  open(10, err=99,action=foo) ! { dg-warning "ACTION specifier in OPEN statement" }
85
 
86
  open(10, err=99,blank="ZERO")
87
  open(10, err=99,blank="nUlL")
88
  open(10, err=99,blank="NULLL") ! { dg-warning "BLANK specifier in OPEN statement" }
89
 
90
  open(10, err=99,delim="apostrophe")
91
  open(10, err=99,delim="quote")
92
  open(10, err=99,delim="none")
93
  open(10, err=99,delim="") ! { dg-warning "DELIM specifier in OPEN statement" }
94
 
95
  open(10, err=99,form="formatted")
96
  open(10, err=99,form="unformatted")
97
  open(10, err=99,form="default") ! { dg-warning "FORM specifier in OPEN statement" }
98
 
99
  open(10, err=99,pad="yes")
100
  open(10, err=99,pad="no")
101
  open(10, err=99,pad=foo) ! { dg-warning "PAD specifier in OPEN statement" }
102
 
103
  open(10, err=99,position="asis")
104
  open(10, err=99,position="rewind")
105
  open(10, err=99,position="append")
106
  open(10, err=99,position=foo) ! { dg-warning "POSITION specifier in OPEN statement" }
107
 
108
  open(10, err=99,recl="ee") ! { dg-warning "must be of type INTEGER" }
109
  open(10, err=99,recl=0.4) ! { dg-warning "must be of type INTEGER" }
110
  open(10, err=99,recl=zero) ! { dg-warning "must be positive" }
111
  open(10, err=99,recl=mone) ! { dg-warning "must be positive" }
112
 
113
  open(10, err=99,status="unknown")
114
  open(10, err=99,status="old")
115
  open(10, err=99,status=foo) ! { dg-warning "STATUS specifier in OPEN statement" }
116
 
117
  open(10, err=99,status="new") ! { dg-warning "no FILE specifier is present" }
118
  open(10, err=99,status="replace   ") ! { dg-warning "no FILE specifier is present" }
119
  open(10, err=99,status="scratch",file=str) ! { dg-warning "cannot have the value SCRATCH if a FILE specifier is present" }
120
 
121
  open(10, err=99,form="unformatted",delim="none") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
122
  open(10, err=99,form="unformatted",pad="yes") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
123
  open(10, err=99,form="unformatted",blank="null") ! { dg-warning "not allowed in OPEN statement for unformatted I/O" }
124
 
125
  open(10, err=99,access="direct",position="append") ! { dg-warning "only allowed for stream or sequential ACCESS" }
126
 
127
  close(10, err=99,status="keep")
128
  close(10, err=99,status="delete")
129
  close(10, err=99,status=foo) ! { dg-warning "STATUS specifier in CLOSE statement" }
130
 
131
 99 continue
132
 
133
! Test for errors
134
 
135
  open(10,access="sequential   ")
136
  open(10,access="sequential   u") ! { dg-error "ACCESS specifier in OPEN statement" }
137
  open(10,access=foo) ! { dg-error "ACCESS specifier in OPEN statement" }
138
  open(10,access="direct")
139
  open(10,access="stream")
140
  open(10,access="append") ! { dg-warning "Extension: ACCESS specifier in OPEN statement" }
141
 
142
  open(10,action="read")
143
  open(10,action="write")
144
  open(10,action="readwrite")
145
  open(10,action=foo) ! { dg-error "ACTION specifier in OPEN statement" }
146
 
147
  open(10,blank="ZERO")
148
  open(10,blank="nUlL")
149
  open(10,blank="NULLL") ! { dg-error "BLANK specifier in OPEN statement" }
150
 
151
  open(10,delim="apostrophe")
152
  open(10,delim="quote")
153
  open(10,delim="none")
154
  open(10,delim="") ! { dg-error "DELIM specifier in OPEN statement" }
155
 
156
  open(10,form="formatted")
157
  open(10,form="unformatted")
158
  open(10,form="default") ! { dg-error "FORM specifier in OPEN statement" }
159
 
160
  open(10,pad="yes")
161
  open(10,pad="no")
162
  open(10,pad=foo) ! { dg-error "PAD specifier in OPEN statement" }
163
 
164
  open(10,position="asis")
165
  open(10,position="rewind")
166
  open(10,position="append")
167
  open(10,position=foo) ! { dg-error "POSITION specifier in OPEN statement" }
168
 
169
  open(10,recl="ee") ! { dg-error "must be of type INTEGER" }
170
  open(10,recl=0.4) ! { dg-error "must be of type INTEGER" }
171
  open(10,recl=zero) ! { dg-error "must be positive" }
172
  open(10,recl=mone) ! { dg-error "must be positive" }
173
 
174
  open(10,status="unknown")
175
  open(10,status="old")
176
  open(10,status=foo) ! { dg-error "STATUS specifier in OPEN statement" }
177
 
178
  open(10,status="new") ! { dg-error "no FILE specifier is present" }
179
  open(10,status="replace   ") ! { dg-error "no FILE specifier is present" }
180
  open(10,status="scratch",file=str) ! { dg-error "cannot have the value SCRATCH if a FILE specifier is present" }
181
 
182
  open(10,form="unformatted",delim="none") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
183
  open(10,form="unformatted",pad="yes") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
184
  open(10,form="unformatted",blank="null") ! { dg-error "not allowed in OPEN statement for unformatted I/O" }
185
 
186
  open(10,access="direct",position="append") ! { dg-error "only allowed for stream or sequential ACCESS" }
187
 
188
  close(10,status="keep")
189
  close(10,status="delete")
190
  close(10,status=foo) ! { dg-error "STATUS specifier in CLOSE statement" }
191
end

powered by: WebSVN 2.1.0

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