Debian Codegraph @

gcc/testsuite/gfortran.dg/submodule_17.f08

raw
1 ! { dg-do run }
2 !
3 ! Tests the fix for PR77358, in which the wrong gfc_charlen was
4 ! being used for the result of 'get'.
5 !
6 ! Contributed by Damian Rouson <[email protected]>
7 !
8 module hello_interface
9 character(len=13) :: string="Hello, world!"
10 interface
11 module function get() result(result_string)
12 character(:), allocatable :: result_string
13 end function
14 end interface
15 end module
16
17 submodule(hello_interface) hello_implementation
18 contains
19 module function get() result(result_string)
20 character(:), allocatable :: result_string
21 result_string = string
22 end function
23 end submodule
24
25 use hello_interface
26 if (get() .ne. string) STOP 1
27 end