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