| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Test for PR 35150, reduced testcases by Tobias Burnus |
| 4 |
! |
| 5 |
module test1 |
| 6 |
use, intrinsic :: iso_c_binding |
| 7 |
implicit none |
| 8 |
contains |
| 9 |
subroutine sub1(argv) bind(c,name="sub1") |
| 10 |
type(c_ptr), intent(in) :: argv |
| 11 |
end subroutine |
| 12 |
|
| 13 |
subroutine sub2 |
| 14 |
type(c_ptr), dimension(1), target :: argv = c_null_ptr |
| 15 |
character(c_char), dimension(1), target :: s = c_null_char |
| 16 |
call sub1(c_loc(argv)) |
| 17 |
end subroutine |
| 18 |
end module test1 |
| 19 |
|
| 20 |
program test2 |
| 21 |
use iso_c_binding |
| 22 |
type(c_ptr), target, save :: argv |
| 23 |
interface |
| 24 |
subroutine sub1(argv) bind(c) |
| 25 |
import |
| 26 |
type(c_ptr), intent(in) :: argv |
| 27 |
end subroutine sub1 |
| 28 |
end interface |
| 29 |
call sub1(c_loc(argv)) |
| 30 |
end program test2 |
| 31 |
! |