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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-09-26
     Ever confirmed|0                           |1

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #3)
> I think the problem here is that fortran uses "long int" while size_t
> interoperate with "unsigned long int".
> Does fortran standard promise that the value should inter-operate with
> size_t as well?

This is a matter for the compiler.

In this case, the documentation states

For arguments of @code{CHARACTER} type, the character length is passed
as a hidden argument at the end of the argument list.  For
deferred-length strings, the value is passed by reference, otherwise
by value.  The character length has the C type @code{size_t} (or
@code{INTEGER(kind=C_SIZE_T)} in Fortran).

so the documentation is actually inconsistent (but then, interoperbility
between Fortran integers and C unsigned types is sort of assumed).
The library uses gfc_charlen_type, which is a typedef to size_t.

So, we can fix this either way.  It would probably be best to have
size_t in the character lengths in the front end as well.

Reply via email to