GDB copyright headers update after running GDB's copyright.py script.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-sub.f90
1 ! Copyright 2015-2016 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 2 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, write to the Free Software
15 ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 !
17 ! Original file written by Jakub Jelinek <jakub@redhat.com> and
18 ! Jan Kratochvil <jan.kratochvil@redhat.com>.
19 ! Modified for the GDB testcases by Keven Boell <keven.boell@intel.com>.
20
21 subroutine foo (array1, array2)
22 integer :: array1 (:, :)
23 real :: array2 (:, :, :)
24
25 array1(:,:) = 5 ! not-filled
26 array1(1, 1) = 30
27
28 array2(:,:,:) = 6 ! array1-filled
29 array2(:,:,:) = 3
30 array2(1,1,1) = 30
31 array2(3,3,3) = 90 ! array2-almost-filled
32 end subroutine
33
34 subroutine bar (array1, array2)
35 integer :: array1 (*)
36 integer :: array2 (4:9, 10:*)
37
38 array1(5:10) = 1311
39 array1(7) = 1
40 array1(100) = 100
41 array2(4,10) = array1(7)
42 array2(4,100) = array1(7)
43 return ! end-of-bar
44 end subroutine
45
46 program vla_sub
47 interface
48 subroutine foo (array1, array2)
49 integer :: array1 (:, :)
50 real :: array2 (:, :, :)
51 end subroutine
52 end interface
53 interface
54 subroutine bar (array1, array2)
55 integer :: array1 (*)
56 integer :: array2 (4:9, 10:*)
57 end subroutine
58 end interface
59
60 real, allocatable :: vla1 (:, :, :)
61 integer, allocatable :: vla2 (:, :)
62
63 ! used for subroutine
64 integer :: sub_arr1(42, 42)
65 real :: sub_arr2(42, 42, 42)
66 integer :: sub_arr3(42)
67
68 sub_arr1(:,:) = 1 ! vla2-deallocated
69 sub_arr2(:,:,:) = 2
70 sub_arr3(:) = 3
71
72 call foo(sub_arr1, sub_arr2)
73 call foo(sub_arr1(5:10, 5:10), sub_arr2(10:15,10:15,10:15))
74
75 allocate (vla1 (10,10,10))
76 allocate (vla2 (20,20))
77 vla1(:,:,:) = 1311
78 vla2(:,:) = 42
79 call foo(vla2, vla1)
80
81 call bar(sub_arr3, sub_arr1)
82 end program vla_sub
This page took 0.031504 seconds and 4 git commands to generate.