]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.fortran/nested-funcs-2.f90
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / nested-funcs-2.f90
1 ! Copyright 2019-2023 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 module container
17 implicit none
18 integer :: a
19 contains
20 subroutine print_from_module()
21 print *, "hello."
22 end subroutine
23 end module
24
25 program contains_keyword
26 use container
27 implicit none
28 integer :: program_i, program_j
29 program_j = 12 ! pre_init
30 program_i = 7
31 program_j = increment(program_j) ! pre_increment
32 program_i = increment_program_global() ! pre_increment_program_global
33 call subroutine_to_call()
34 call step() ! pre_step
35 call hidden_variable()
36 call print_from_module()
37 print '(I2)', program_j, program_i ! post_init
38
39 contains
40 subroutine subroutine_to_call()
41 print *, "called"
42 end subroutine
43 integer function increment(i)
44 integer :: i
45 increment = i + 1
46 print *, i ! post_increment
47 end function
48 integer function increment_program_global()
49 increment_program_global = program_i + 1
50 ! Need to put in a dummy print here to break on as on some systems the
51 ! variables leave scope at "end function", but on others they do not.
52 print *, program_i ! post_increment_global
53 end function
54 subroutine step()
55 print '(A)', "step" ! post_step
56 end subroutine
57 subroutine hidden_variable()
58 integer :: program_i
59 program_i = 30
60 print *, program_i ! post_hidden
61 end subroutine
62 end program contains_keyword