https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125902

--- Comment #9 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
(In reply to Nicholas BREALEY from comment #8)
> No, I do not think that is correct.
> 
> character(kind=c_char,len=*), intent(in) :: c
> 
> should translate to a const CFI_cdesc_t* c.
> 
> My test program would not have worked if it was const char *c.
> 
> Section 18.3.7 "Interoperability of procedures and procedure interfaces" in
> J3/23-007r1 says:
>  A Fortran procedure interface is interoperable with a C function prototype
> if
>  ...
>    (5) any dummy argument without the VALUE attribute corresponds to a
> formal parameter of the prototype that is of a pointer type, and either
>  ...
>        the dummy argument is a nonallocatable nonpointer variable of type
> CHARACTER with
>     assumed character length and the formal parameter is a pointer to
> CFI_cdesc_t,
> (J3/18-007r1 is the same)
> 
> NB
> character(kind=c_char,len=1), dimension(*), intent(in) :: c
> translates to const char *c.

You are right.  Thanks for pointing this out.

I will push an adjusted patch.

Reply via email to