PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / public_private_module_8.f90
blobbfc1b368f46ba0b8ea4a12b9358d38bddfe4a8c0
1 ! { dg-do compile }
2 ! { dg-options "-O2" }
4 ! PR fortran/54884
6 ! Check that get_key_len is not optimized away as it
7 ! is used in a publicly visible specification expression.
10 module m
11 private
12 public :: foo
13 interface foo
14 module procedure bar
15 end interface foo
16 contains
17 pure function mylen()
18 integer :: mylen
19 mylen = 42
20 end function mylen
21 pure function myotherlen()
22 integer :: myotherlen
23 myotherlen = 99
24 end function myotherlen
25 subroutine bar(x)
26 character(len=mylen()) :: x
27 character :: z2(myotherlen())
28 call internal(x)
29 block
30 character(len=myotherlen()) :: z
31 z = "abc"
32 x(1:5) = z
33 end block
34 x(6:10) = intern_func()
35 contains
36 function intern_func()
37 character(len=myotherlen()) :: intern_func
38 intern_func = "zuzu"
39 end function intern_func
40 subroutine internal(y)
41 character(len=myotherlen()) :: y
42 y = "abc"
43 end subroutine internal
44 end subroutine bar
45 end module m
47 ! { dg-final { scan-assembler-not "__m_MOD_myotherlen" } }
48 ! { dg-final { scan-assembler "__m_MOD_bar" } }
49 ! { dg-final { scan-assembler "__m_MOD_mylen" } }