xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.fortran/nested-funcs.f90 (revision 82d56013d7b633d116a93943de88e08335357a7c)
1! Copyright 2016-2019 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
16program TestNestedFuncs
17
18  IMPLICIT NONE
19
20  TYPE :: t_State
21    integer :: code
22  END TYPE t_State
23
24  TYPE (t_State) :: v_state
25  integer index
26
27  index = 13
28  CALL sub_nested_outer
29  index = 11              ! BP_main
30  v_state%code = 27
31
32CONTAINS
33
34  SUBROUTINE sub_nested_outer
35    integer local_int
36    local_int = 19
37    v_state%code = index + local_int   ! BP_outer
38    call sub_nested_inner
39    local_int = 22                     ! BP_outer_2
40    RETURN
41  END SUBROUTINE sub_nested_outer
42
43  SUBROUTINE sub_nested_inner
44    integer local_int
45    local_int = 17
46    v_state%code = index + local_int   ! BP_inner
47    RETURN
48  END SUBROUTINE sub_nested_inner
49
50end program TestNestedFuncs
51