1! Copyright 2015-2023 Free Software Foundation, Inc. 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 16program vla 17 real, target, allocatable :: vla1 (:, :, :) 18 real, target, allocatable :: vla2 (:, :, :) 19 real, target, allocatable :: vla3 (:, :) 20 real, pointer :: pvla (:, :, :) 21 logical :: l 22 nullify(pvla) 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 58 allocate (vla1 (-2:-1, -5:-2, -3:-1)) 59 vla1(:, :, :) = 1 60 vla1(-2, -3, -1) = -231 61 62 deallocate (vla1) ! vla1-neg-bounds-v1 63 l = allocated(vla1) 64 65 allocate (vla1 (-2:1, -5:2, -3:1)) 66 vla1(:, :, :) = 2 67 vla1(-2, -4, -2) = -242 68 69 deallocate (vla1) ! vla1-neg-bounds-v2 70 l = allocated(vla1) 71 72end program vla 73