]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.fortran/allocated.f90
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / allocated.f90
1 ! Copyright 2021-2022 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
16 !
17 ! Start of test program.
18 !
19 program test
20
21 integer, allocatable :: array (:, :)
22 logical is_allocated
23
24 is_allocated = allocated (array)
25 print *, is_allocated ! Breakpoint 1
26
27 ! Allocate or associate any variables as needed.
28 allocate (array (-5:4, -2:7))
29
30 is_allocated = allocated (array)
31 print *, is_allocated ! Breakpoint 2
32
33 deallocate (array)
34
35 is_allocated = allocated (array)
36 print *, is_allocated ! Breakpoint 3
37
38 allocate (array (3:8, 2:7))
39
40 is_allocated = allocated (array)
41 print *, is_allocated ! Breakpoint 4
42
43 ! All done. Deallocate.
44 deallocate (array)
45
46 is_allocated = allocated (array)
47 print *, is_allocated ! Breakpoint 5
48
49 end program test