Automatic date update in version.in
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.fortran / class-allocatable-array.f90
blob804a2d5ae3f2888d085f2b87cff26e91f06276ea
1 ! Copyright 2020-2022 Free Software Foundation, Inc.
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.
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.
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/>.
16 module test_module
17 type test_type
18 integer a
19 real, allocatable :: b (:, :)
20 contains
21 procedure :: test_proc
22 end type test_type
24 contains
26 subroutine test_proc (this)
27 class(test_type), intent (inout) :: this
28 allocate (this%b (3, 2))
29 call fill_array_2d (this%b)
30 print *, "" ! Break Here
31 contains
32 ! Helper subroutine to fill 2-dimensional array with unique
33 ! values.
34 subroutine fill_array_2d (array)
35 real, dimension (:,:) :: array
36 real :: counter
38 counter = 1.0
39 do i=LBOUND (array, 2), UBOUND (array, 2), 1
40 do j=LBOUND (array, 1), UBOUND (array, 1), 1
41 array (j,i) = counter
42 counter = counter + 1
43 end do
44 end do
45 end subroutine fill_array_2d
46 end subroutine test_proc
47 end module
49 program test
50 use test_module
51 implicit none
52 type(test_type) :: t
53 call t%test_proc ()
54 end program test