| 1 | c Fortran 77 Standard Sec. 5.1.2.2 Dummy_Array_Declarator
|
|---|
| 2 | c Dummy arrays may have adjustable or assumed size
|
|---|
| 3 | subroutine sub(a, b, c, d, e, f, g, low, high)
|
|---|
| 4 | implicit none
|
|---|
| 5 | integer low, high
|
|---|
| 6 | integer a(low:high), b(high), c(*), d(low:*), e(1,*)
|
|---|
| 7 | integer f(4), g(2,2)
|
|---|
| 8 | integer correct(6)
|
|---|
| 9 | correct = (/1,2,3,4,5,6/)
|
|---|
| 10 | c$ civl assert(all(a .eq. correct(1:3)))
|
|---|
| 11 | c$ civl assert(all(a(2:4) .eq. correct(1:3)))
|
|---|
| 12 | c$ civl assert(all(b .eq. correct(1:4)))
|
|---|
| 13 | c$ civl assert(all(b(1:4) .eq. correct(1:4)))
|
|---|
| 14 | c$ civl assert(all(c(1:6) .eq. correct))
|
|---|
| 15 | c$ civl assert(all(d(2:7) .eq. correct))
|
|---|
| 16 | c$ civl assert(all(e(1,1:6) .eq. correct))
|
|---|
| 17 | c Dummy arrays can be smaller than the actual argument
|
|---|
| 18 | c$ civl assert(all(f .eq. correct(1:4)))
|
|---|
| 19 | c Dummy arrays can have a shape that differs from that of the actual argument
|
|---|
| 20 | c$ civl assert(all(g .eq. correct(1:4)))
|
|---|
| 21 |
|
|---|
| 22 | c Sec. 5.5: the variables involved in an adjustable dimension may be
|
|---|
| 23 | c redefined or become undefined during execution of the external procedure
|
|---|
| 24 | c with no effect on the above-mentioned properties.
|
|---|
| 25 | low = 1
|
|---|
| 26 | high = 1
|
|---|
| 27 | c$ civl assert(all(a .eq. correct(1:3)))
|
|---|
| 28 | a = (/7,8,9/)
|
|---|
| 29 | end subroutine
|
|---|
| 30 |
|
|---|
| 31 | program p
|
|---|
| 32 | implicit none
|
|---|
| 33 | integer a(6), b(6), c(6), d(6), e(6), f(6), g(6)
|
|---|
| 34 | a = (/1,2,3,4,5,6/)
|
|---|
| 35 | b = a
|
|---|
| 36 | c = a
|
|---|
| 37 | d = a
|
|---|
| 38 | e = a
|
|---|
| 39 | f = a
|
|---|
| 40 | g = a
|
|---|
| 41 | call sub(a(1:3),b(1:4),c,d,e,f,g,2,4)
|
|---|
| 42 | c$ civl assert(all(a(1:3) .eq. (/7,8,9/)))
|
|---|
| 43 | c$ civl assert(all(a(4:6) .eq. (/4,5,6/)))
|
|---|
| 44 | end program
|
|---|