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