1 ! RUN: %flang_fc1 -fdebug-unparse-with-symbols -DSTRICT_F18 -pedantic %s 2>&1 | FileCheck %s
2 ! RUN: %flang_fc1 -fdebug-unparse-with-symbols -DARCHAIC_FORTRAN %s 2>&1 | FileCheck %s
3 ! CHECK-NOT: :{{[[:space:]]}}error:{{[[:space:]]}}
4 ! FIXME: the above check line does not work because diags are not emitted with error: in them.
6 ! these are the conformance tests
7 ! define STRICT_F18 to eliminate tests of features not in F18
8 ! define ARCHAIC_FORTRAN to add test of feature found in Fortran before F95
10 subroutine sub00(a,b,n,m)
15 1234 print *, a(n), b(1)
16 99999 print *, a(1), b(m)
19 subroutine do_loop01(a,n)
21 real, dimension(n) :: a
25 end subroutine do_loop01
27 subroutine do_loop02(a,n)
29 real, dimension(n,n) :: a
32 print *, i, j, a(i, j)
34 end subroutine do_loop02
37 subroutine do_loop03(a,n)
39 real, dimension(n) :: a
41 10 print *, i, a(i) ! extension (not f18)
42 end subroutine do_loop03
44 subroutine do_loop04(a,n)
49 10 print *, i, j, a(i, j) ! extension (not f18)
50 end subroutine do_loop04
52 subroutine do_loop05(a,n)
58 10 print *, a(i, j, k) ! extension (not f18)
59 end subroutine do_loop05
62 subroutine do_loop06(a,n)
64 real, dimension(n) :: a
71 end subroutine do_loop06
73 subroutine do_loop07(a,n)
75 real, dimension(n,n) :: a
78 print *, i, j, a(i, j)
81 end subroutine do_loop07
84 subroutine do_loop08(a,b,n,m,nn)
86 real, dimension(n,n) :: a
89 condone: if (m .lt. n) then
91 condtwo: if (n .lt. nn) then
100 else if (n .lt. m) then
101 loopthree: do i = 1, n
102 condthree: if (n .lt. nn) then
114 end subroutine do_loop08
118 ! extended ranges supported by PGI, gfortran gives warnings
119 subroutine do_loop09(a,n,j)
123 200 print *, "found the index", j
124 print *, "value at", j, "is", a(j)
125 goto 300 ! FIXME: emits diagnostic even without -pedantic
128 goto 200 ! extension: extended GOTO ranges
135 end subroutine do_loop09
138 subroutine goto10(a,b,n)
139 dimension :: a(3), b(3)
142 4 labelit: if (a(n-1) .ne. b(n-2)) then
145 567 end subroutine goto10
147 subroutine computed_goto11(i,j,k)
154 200 end subroutine computed_goto11
157 subroutine arith_if12(i)
167 end subroutine arith_if12
171 subroutine alt_return_spec13(i,*,*,*)
173 8 labelme: if (i .lt. 42) then
175 6 else if (i .lt. 94) then
177 4 else if (i .lt. 645) then
180 1 end subroutine alt_return_spec13
182 subroutine alt_return_spec14(i)
183 call alt_return_spec13(i,*6000,*6130,*6457)
191 end subroutine alt_return_spec14
195 subroutine specifiers15(a,b,x)
197 OPEN (10, file="myfile.dat", err=100)
198 READ (10,20,end=200,size=x,advance='no',eor=300) a
202 100 print *,"error opening"
204 200 print *,"end of file"
206 300 print *, "end of record"
210 40 OPEN (11, file="myfile2.dat", err=100)
212 50 WRITE (11,30,err=100) b
214 end subroutine specifiers15
217 #if !defined(STRICT_F18) && defined(ARCHAIC_FORTRAN)
218 ! assigned goto was deleted in F95. PGI supports, gfortran gives warnings
219 subroutine assigned_goto16
227 print *, "archaic feature!"
228 end subroutine assigned_goto16