OSDN Git Service

PR c++/9335
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / bind_c_usage_11.f03
1 ! { dg-do compile }
2 ! { dg-options "-std=gnu" }
3 ! PR fortran/34133
4 !
5 ! The compiler should accept internal procedures with BIND(c) attribute
6 ! for STD GNU / Fortran 2008.
7 !
8 subroutine foo() bind(c)
9 contains
10   subroutine bar() bind (c)
11   end subroutine bar
12 end subroutine foo
13
14 subroutine foo2() bind(c)
15   use iso_c_binding
16 contains
17   integer(c_int) function barbar() bind (c)
18     barbar = 1
19   end function barbar
20 end subroutine foo2
21
22 function one() bind(c)
23   use iso_c_binding
24   integer(c_int) :: one
25   one = 1
26 contains
27   integer(c_int) function two() bind (c)
28     two = 1
29   end function two
30 end function one
31
32 function one2() bind(c)
33   use iso_c_binding
34   integer(c_int) :: one2
35   one2 = 1
36 contains
37   subroutine three() bind (c)
38   end subroutine three
39 end function one2
40
41 program main
42   use iso_c_binding
43   implicit none
44 contains
45   subroutine test() bind(c)
46   end subroutine test
47   integer(c_int) function test2() bind (c)
48     test2 = 1
49   end function test2
50 end program main