2 ! { dg-additional-sources bind_c_usage_16_c.c }
6 ! Ensure character-returning, bind(C) function work.
12 function bar(x) bind(c, name="returnA")
13 character(len=1,kind=c_char) :: bar, x
17 function foo() bind(c, name="returnB")
18 character(len=1,kind=c_char) :: foo
23 subroutine test() bind(c)
26 character(len=1,kind=c_char) :: a
27 character(len=3,kind=c_char) :: b
28 character(len=1,kind=c_char) :: c(3)
29 character(len=3,kind=c_char) :: d(3)
38 if (a /= 'A') call abort()
40 if (b /= 'A' .or. iachar(b(2:2))/=32 .or. iachar(b(3:3))/=32) call abort()
42 if (any(c /= 'A')) call abort()
44 if (any(d /= 'A')) call abort()
47 if (a /= 'B') call abort()
49 if (b /= 'B') call abort()
51 if (any(c /= 'B')) call abort()
53 if (any(d /= 'B')) call abort()
55 if(iachar(d(i)(2:2)) /=32 .or. iachar(d(i)(3:3)) /= 32) call abort()