coarray_41.f90: Add "-latomic" option if libatomic_available.
[official-gcc.git] / gcc / testsuite / gfortran.dg / bind_c_usage_17.f90
blobad7ffd08f3d4f93e02dc37f8bc0c4a374152f5d2
1 ! { dg-do run }
2 ! { dg-additional-sources bind_c_usage_17_c.c }
4 ! PR fortran/37201
6 !
8 MODULE mod
9 INTERFACE
10 FUNCTION cdir() BIND(C,name="cdir") RESULT(r)
11 USE iso_c_binding
12 CHARACTER(kind=C_CHAR) :: r
13 END FUNCTION
14 END INTERFACE
15 END MODULE
17 PROGRAM test
18 USE mod
19 integer :: i = -43
20 character(len=1) :: str1
21 character(len=4) :: str4
22 str1 = 'x'
23 str4 = 'xyzz'
24 str1 = cdir()
25 if(str1 /= '/') call abort()
26 str4 = cdir()
27 if(str4 /= '/' .or. ichar(str4(2:2)) /= 32) call abort()
28 i = ICHAR(cdir())
29 if (i /= 47) call abort()
30 str4 = 'xyzz'
31 WRITE(str4,'(a)') cdir()
32 if(str4 /= '/' .or. ichar(str4(2:2)) /= 32) call abort()
33 str4 = 'xyzz'
34 WRITE(str4,'(i0)') ICHAR(cdir())
35 if(str4 /= '47' .or. ichar(str4(3:3)) /= 32) call abort()
36 END PROGRAM