summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/iso_c_binding_rename_2.f03
blob: e7c18db2f15e4d1fa1608c69db4fda35ebd840f3 (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
35
36
37
38
39
40
41
42
! { dg-do run }
! { dg-additional-sources iso_c_binding_rename_2_driver.c }
module mod0
  use, intrinsic :: iso_c_binding, only: c_ptr, c_associated
end module mod0

module mod1
  use mod0, my_c_ptr => c_ptr, my_c_associated => c_associated
end module mod1

module mod2
contains
  subroutine sub2(my_ptr1) bind(c)
    use mod1, my_c_ptr_2 => my_c_ptr, my_c_associated_2 => my_c_associated
    implicit none
    type(my_c_ptr_2) :: my_ptr1
    if( .not. my_c_associated_2(my_ptr1)) then
       call abort()
    end if
  end subroutine sub2

  subroutine sub3(my_ptr1) bind(c)
    use mod1, my_c_ptr_2 => my_c_ptr
    implicit none
    type(my_c_ptr_2) :: my_ptr1
    if( .not. my_c_associated(my_ptr1)) then
       call abort()
    end if
  end subroutine sub3

  subroutine sub4(my_ptr1) bind(c)
    use mod1, my_c_associated_3 => my_c_associated
    implicit none
    type(my_c_ptr) :: my_ptr1
    if( .not. my_c_associated_3(my_ptr1)) then
       call abort()
    end if
  end subroutine sub4

end module mod2

! { dg-final { cleanup-modules "mod0 mod1 mod2" } }