Debian Codegraph @

gcc/testsuite/gfortran.dg/pr32599.f03

raw
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003" }
3 !
4 ! PR fortran/32599
5 ! Verifies that character string arguments to a bind(c) procedure have length
6 ! 1, or no len is specified. Note that the C interop extensions in F2008 allow
7 ! string arguments of length greater than one to be passed to a C descriptor.
8 !
9 module pr32599
10 interface
11 subroutine destroy(path) BIND(C) ! { dg-error "Fortran 2018: Assumed-length character dummy argument 'path' at .1. of procedure .destroy. with BIND\\(C\\) attribute" }
12 use iso_c_binding
13 implicit none
14 character(len=*,kind=c_char), intent(IN) :: path
15 end subroutine destroy
16
17 subroutine create(path) BIND(C) ! { dg-error "Character dummy argument 'path' at .1. must be of constant length of one or assumed length, unless it has assumed shape or assumed rank, as procedure 'create' has the BIND\\(C\\) attribute" }
18 use iso_c_binding
19 implicit none
20 character(len=5,kind=c_char), intent(IN) :: path
21 end subroutine create
22
23 ! This should be valid.
24 subroutine create1(path) BIND(C)
25 use iso_c_binding
26 implicit none
27 character(len=1,kind=c_char), intent(IN) :: path
28 end subroutine create1
29
30 ! This should be valid.
31 subroutine create2(path) BIND(C)
32 use iso_c_binding
33 implicit none
34 character(kind=c_char), intent(IN) :: path
35 end subroutine create2
36
37 ! This should be valid.
38 subroutine create3(path) BIND(C)
39 use iso_c_binding
40 implicit none
41 character(kind=c_char), dimension(*), intent(IN) :: path
42 end subroutine create3
43 end interface
44 end module pr32599