PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_20.f90
blob0530b6006a6abb66d6f81221bc06a22ad8bb1a89
1 !{ dg-do run }
2 ! Tests namelist io for an explicit shape array with negative bounds
3 ! provided by Paul Thomas - pault@gcc.gnu.org
5 program namelist_20
6 integer, dimension (-4:-2) :: x
7 integer :: i, ier
8 namelist /a/ x
10 open (10, status = "scratch")
11 write (10, '(A)') "&a x(-5)=0 /" !-ve index below lbound
12 write (10, '(A)') "&a x(-1)=0 /" !-ve index above ubound
13 write (10, '(A)') "&a x(1:2)=0 /" !+ve indices
14 write (10, '(A)') "&a x(-4:-2)= -4,-3,-2 /" !correct
15 write (10, '(A)') " "
16 rewind (10)
18 ier=0
19 read(10, a, iostat=ier)
20 if (ier == 0) STOP 1
21 ier=0
22 read(10, a, iostat=ier)
23 if (ier == 0) STOP 2
24 ier=0
25 read(10, a, iostat=ier)
26 if (ier == 0) STOP 3
28 ier=0
29 read(10, a, iostat=ier)
30 if (ier /= 0) STOP 4
31 do i = -4,-2
32 if (x(i) /= i) STOP 5
33 end do
35 end program namelist_20