source: CIVL/mods/dev.civl.abc/examples/fortran/f77_standard/arrays_dummy.f

main
Last change on this file was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.5 KB
Line 
1c Fortran 77 Standard Sec. 5.1.2.2 Dummy_Array_Declarator
2c 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/)
10c$ civl assert(all(a .eq. correct(1:3)))
11c$ civl assert(all(a(2:4) .eq. correct(1:3)))
12c$ civl assert(all(b .eq. correct(1:4)))
13c$ civl assert(all(b(1:4) .eq. correct(1:4)))
14c$ civl assert(all(c(1:6) .eq. correct))
15c$ civl assert(all(d(2:7) .eq. correct))
16c$ civl assert(all(e(1,1:6) .eq. correct))
17c Dummy arrays can be smaller than the actual argument
18c$ civl assert(all(f .eq. correct(1:4)))
19c Dummy arrays can have a shape that differs from that of the actual argument
20c$ civl assert(all(g .eq. correct(1:4)))
21
22c Sec. 5.5: the variables involved in an adjustable dimension may be
23c redefined or become undefined during execution of the external procedure
24c with no effect on the above-mentioned properties.
25 low = 1
26 high = 1
27c$ 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)
42c$ civl assert(all(a(1:3) .eq. (/7,8,9/)))
43c$ civl assert(all(a(4:6) .eq. (/4,5,6/)))
44 end program
Note: See TracBrowser for help on using the repository browser.