c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / module_private_2.f90
blob847c58d5e37cae87c98046ae7696da8d39b6b759
1 ! { dg-do compile }
2 ! { dg-options "-O2 -fdump-tree-optimized" }
4 ! PR fortran/47266
6 ! Check whether the private procedure "priv" is optimized away
8 module m
9 implicit none
10 private :: priv
11 private :: export1, export2
12 public :: pub
13 contains
14 integer function priv()
15 priv = 44
16 end function priv
17 integer function export1()
18 export1 = 45
19 end function export1
20 function export2() bind(C) ! { dg-warning "is marked PRIVATE" }
21 use iso_c_binding, only: c_int
22 integer(c_int) :: export2
23 export2 = 46
24 end function export2
25 subroutine pub(a,b)
26 integer :: a
27 procedure(export1), pointer :: b
28 a = priv()
29 b => export1
30 end subroutine pub
31 end module m
32 ! { dg-final { scan-tree-dump-times "priv" 0 "optimized" } }
33 ! { dg-final { scan-tree-dump-times "export1 \\(\\)" 1 "optimized" } }
34 ! { dg-final { scan-tree-dump-times "export2 \\(\\)" 1 "optimized" } }