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

--- Comment #8 from Nicholas BREALEY <Nicholas.BREALEY at 3ds dot com> ---
Thank you for looking at this.

(In reply to Harald Anlauf from comment #5)
> Yes, there are some issues.
> 
> Note:
> 
>       character(kind=c_char,len=*), intent(in) :: c
> 
> should not translate to const CFI_cdesc_t* c but to const char *c,
> so that one seems correct to me.

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.

> 
> Removing the ALLOCATABLE attribute in
> 
>       real(c_double), dimension(:), allocatable, intent(inout) :: d
> 
> "fixes" this particular one and produces CFI_cdesc_t *d.

Reply via email to