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.1.5  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.1.3  christos ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15      1.1  christos !
     16      1.1  christos ! Original file written by Jakub Jelinek <jakub@redhat.com> and
     17      1.1  christos ! Jan Kratochvil <jan.kratochvil@redhat.com>.
     18      1.1  christos ! Modified for the GDB testcases by Keven Boell <keven.boell@intel.com>.
     19      1.1  christos 
     20      1.1  christos subroutine foo (array1, array2)
     21      1.1  christos   integer :: array1 (:, :)
     22      1.1  christos   real    :: array2 (:, :, :)
     23      1.1  christos 
     24      1.1  christos   array1(:,:) = 5                       ! not-filled
     25      1.1  christos   array1(1, 1) = 30
     26      1.1  christos 
     27      1.1  christos   array2(:,:,:) = 6                     ! array1-filled
     28      1.1  christos   array2(:,:,:) = 3
     29      1.1  christos   array2(1,1,1) = 30
     30      1.1  christos   array2(3,3,3) = 90                    ! array2-almost-filled
     31      1.1  christos end subroutine
     32      1.1  christos 
     33      1.1  christos subroutine bar (array1, array2)
     34      1.1  christos   integer :: array1 (*)
     35      1.1  christos   integer :: array2 (4:9, 10:*)
     36      1.1  christos 
     37      1.1  christos   array1(5:10) = 1311
     38      1.1  christos   array1(7) = 1
     39      1.1  christos   array1(100) = 100
     40      1.1  christos   array2(4,10) = array1(7)
     41      1.1  christos   array2(4,100) = array1(7)
     42      1.1  christos   return                                ! end-of-bar
     43      1.1  christos end subroutine
     44      1.1  christos 
     45      1.1  christos program vla_sub
     46      1.1  christos   interface
     47      1.1  christos     subroutine foo (array1, array2)
     48      1.1  christos       integer :: array1 (:, :)
     49      1.1  christos       real :: array2 (:, :, :)
     50      1.1  christos     end subroutine
     51      1.1  christos   end interface
     52      1.1  christos   interface
     53      1.1  christos     subroutine bar (array1, array2)
     54      1.1  christos       integer :: array1 (*)
     55      1.1  christos       integer :: array2 (4:9, 10:*)
     56      1.1  christos     end subroutine
     57      1.1  christos   end interface
     58      1.1  christos 
     59      1.1  christos   real, allocatable :: vla1 (:, :, :)
     60      1.1  christos   integer, allocatable :: vla2 (:, :)
     61      1.1  christos 
     62      1.1  christos   ! used for subroutine
     63      1.1  christos   integer :: sub_arr1(42, 42)
     64      1.1  christos   real    :: sub_arr2(42, 42, 42)
     65      1.1  christos   integer :: sub_arr3(42)
     66      1.1  christos 
     67      1.1  christos   sub_arr1(:,:) = 1                   ! vla2-deallocated
     68      1.1  christos   sub_arr2(:,:,:) = 2
     69      1.1  christos   sub_arr3(:) = 3
     70      1.1  christos 
     71      1.1  christos   call foo(sub_arr1, sub_arr2)
     72      1.1  christos   call foo(sub_arr1(5:10, 5:10), sub_arr2(10:15,10:15,10:15))
     73      1.1  christos 
     74      1.1  christos   allocate (vla1 (10,10,10))
     75      1.1  christos   allocate (vla2 (20,20))
     76      1.1  christos   vla1(:,:,:) = 1311
     77      1.1  christos   vla2(:,:) = 42
     78      1.1  christos   call foo(vla2, vla1)
     79      1.1  christos 
     80      1.1  christos   call bar(sub_arr3, sub_arr1)
     81      1.1  christos end program vla_sub
     82