2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_zerosize_3.f
blob57f2d75b67c99041ba1d89f13c22d64e56c2ec72
1 C { dg-do run }
2 C Test the fix for PR35698, in which the negative size dimension would
3 C throw out the subsequent bounds.
5 C Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
7 program try_lf0030
8 call LF0030(10)
9 end
11 SUBROUTINE LF0030(nf10)
12 INTEGER ILA1(7)
13 INTEGER ILA2(7)
14 LOGICAL LLA(:,:,:,:,:,:,:)
15 INTEGER ICA(7)
16 ALLOCATABLE LLA
19 ALLOCATE (LLA(2:3, 4, 0:5,
20 $ NF10:1, -2:7, -3:8,
21 $ -4:9))
23 ILA1 = LBOUND(LLA)
24 ILA2 = UBOUND(LLA)
25 C CORRECT FOR THE ZERO DIMENSIONED TERM TO ALLOW AN EASIER VERIFY
26 ILA1(4) = ILA1(4) - 2 ! 1 - 2 = -1
27 ILA2(4) = ILA2(4) + 6 ! 0 + 6 = 6
29 DO J1 = 1,7
30 IVAL = 3-J1
31 IF (ILA1(J1) .NE. IVAL) call abort ()
32 100 ENDDO
34 DO J1 = 1,7
35 IVAL = 2+J1
36 IF (ILA2(J1) .NE. IVAL) call abort ()
37 101 ENDDO
39 END SUBROUTINE