https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107266
--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, Oct 18, 2022 at 10:40:59AM +0000, burnus at gcc dot gnu.org wrote: > > (b) subroutine bar(x, y, z) bind(C) > character(kind=4,len=*) :: x > character(kind=4) :: y(:) > character(kind=4), allocatable :: z > > This one is valid as F2018's "18.3.6 Interoperability of procedures and > procedure interfaces" states: I'm going to assume that you did not compile the above, or read the patch. % gfcx -c a.f90 a.f90:1:22: 1 | subroutine bar(x, y, z) bind(C) | 1 Error: Allocatable character dummy argument 'z' at (1) must have deferred length as procedure 'bar' is BIND(C) % cat a.f90 subroutine bar(x, y, z) bind(C) character(kind=4,len=*) :: x character(kind=4) :: y(:) character(kind=4,len=:), allocatable :: z end subroutine bar % gfcx -c a.f90 && nm a.o | grep bar 0000000000000000 T bar % gfcx -c -std=f2018 a.f90 && nm a.o | grep bar 0000000000000000 T bar % cat a.f90 character(kind=4) function bar(x, y, z) bind(C) character(kind=4,len=*) :: x character(kind=4) :: y(:) character(kind=4,len=:), allocatable :: z end function bar % gfcx -c a.f90 && nm a.o | grep bar 0000000000000000 T bar % gfcx -c -std=f2018 a.f90 a.f90:1:30: 1 | character(kind=4) function bar(x, y, z) bind(C) | 1 Error: GNU Extension: Symbol 'bar' at (1) with type CHARACTER(KIND=4) cannot have the BIND(C) attribute The patch checks a *function* result variable for an interoperable CHARACTER kind.