Commit | Line | Data |
---|---|---|
618f726f | 1 | ! Copyright 2015-2016 Free Software Foundation, Inc. |
3f2f83dd KB |
2 | ! |
3 | ! This program is free software; you can redistribute it and/or modify | |
4 | ! it under the terms of the GNU General Public License as published by | |
5 | ! the Free Software Foundation; either version 3 of the License, or | |
6 | ! (at your option) any later version. | |
7 | ! | |
8 | ! This program is distributed in the hope that it will be useful, | |
9 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | ! GNU General Public License for more details. | |
12 | ! | |
13 | ! You should have received a copy of the GNU General Public License | |
14 | ! along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | program vla | |
17 | real, target, allocatable :: vla1 (:, :, :) | |
18 | real, target, allocatable :: vla2 (:, :, :) | |
19 | real, target, allocatable :: vla3 (:, :) | |
20 | real, pointer :: pvla (:, :, :) | |
21 | logical :: l | |
ba881f50 | 22 | nullify(pvla) |
3f2f83dd KB |
23 | |
24 | allocate (vla1 (10,10,10)) ! vla1-init | |
25 | l = allocated(vla1) | |
26 | ||
27 | allocate (vla2 (1:7,42:50,13:35)) ! vla1-allocated | |
28 | l = allocated(vla2) | |
29 | ||
30 | vla1(:, :, :) = 1311 ! vla2-allocated | |
31 | vla1(3, 6, 9) = 42 | |
32 | vla1(1, 3, 8) = 1001 | |
33 | vla1(6, 2, 7) = 13 | |
34 | ||
35 | vla2(:, :, :) = 1311 ! vla1-filled | |
36 | vla2(5, 45, 20) = 42 | |
37 | ||
38 | pvla => vla1 ! vla2-filled | |
39 | l = associated(pvla) | |
40 | ||
41 | pvla => vla2 ! pvla-associated | |
42 | l = associated(pvla) | |
43 | pvla(5, 45, 20) = 1 | |
44 | pvla(7, 45, 14) = 2 | |
45 | ||
46 | pvla => null() ! pvla-re-associated | |
47 | l = associated(pvla) | |
48 | ||
49 | deallocate (vla1) ! pvla-deassociated | |
50 | l = allocated(vla1) | |
51 | ||
52 | deallocate (vla2) ! vla1-deallocated | |
53 | l = allocated(vla2) | |
54 | ||
55 | allocate (vla3 (2,2)) ! vla2-deallocated | |
56 | vla3(:,:) = 13 | |
57 | end program vla |