| 1 | ! Copyright 2016-2019 Free Software Foundation, Inc.\r |
| 2 | !\r |
| 3 | ! This program is free software; you can redistribute it and/or modify\r |
| 4 | ! it under the terms of the GNU General Public License as published by\r |
| 5 | ! the Free Software Foundation; either version 3 of the License, or\r |
| 6 | ! (at your option) any later version.\r |
| 7 | !\r |
| 8 | ! This program is distributed in the hope that it will be useful,\r |
| 9 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of\r |
| 10 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r |
| 11 | ! GNU General Public License for more details.\r |
| 12 | !\r |
| 13 | ! You should have received a copy of the GNU General Public License\r |
| 14 | ! along with this program. If not, see <http://www.gnu.org/licenses/>.\r |
| 15 | \r |
| 16 | program TestNestedFuncs\r |
| 17 | \r |
| 18 | IMPLICIT NONE\r |
| 19 | \r |
| 20 | TYPE :: t_State\r |
| 21 | integer :: code\r |
| 22 | END TYPE t_State\r |
| 23 | \r |
| 24 | TYPE (t_State) :: v_state\r |
| 25 | integer index\r |
| 26 | \r |
| 27 | index = 13\r |
| 28 | CALL sub_nested_outer\r |
| 29 | index = 11 ! BP_main\r |
| 30 | v_state%code = 27\r |
| 31 | \r |
| 32 | CONTAINS\r |
| 33 | \r |
| 34 | SUBROUTINE sub_nested_outer\r |
| 35 | integer local_int\r |
| 36 | local_int = 19\r |
| 37 | v_state%code = index + local_int ! BP_outer\r |
| 38 | call sub_nested_inner\r |
| 39 | local_int = 22 ! BP_outer_2\r |
| 40 | RETURN\r |
| 41 | END SUBROUTINE sub_nested_outer\r |
| 42 | \r |
| 43 | SUBROUTINE sub_nested_inner\r |
| 44 | integer local_int\r |
| 45 | local_int = 17\r |
| 46 | v_state%code = index + local_int ! BP_inner\r |
| 47 | RETURN\r |
| 48 | END SUBROUTINE sub_nested_inner\r |
| 49 | \r |
| 50 | end program TestNestedFuncs\r |