https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84073
Bug ID: 84073 Summary: In -fc-prototypes fixed (nonzero) length strings are mapped to plain char in prototype. Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: emsr at gcc dot gnu.org Target Milestone: --- Created attachment 43260 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43260&action=edit Module with fixed length strings. Given this: =============================================================================== ! ../../bin/bin/gfortran -c -fc-prototypes fixlen_character.f95 module utderror use iso_c_binding type, bind(c) :: utderror_t integer(c_int) :: projectid integer(c_int) :: txantennaid integer(c_int) :: rxantennaid integer(c_int) :: pathid integer(c_int) :: frequencysetid integer(c_int) :: frequencyid integer(c_int) :: errornumber integer(c_int) :: nerrorloc real(c_double) :: errorstartloc(3) real(c_double) :: errorendloc(3) character(kind=c_char, len=41) :: errorsubsystem character(kind=c_char, len=9) :: errorseverity integer(c_int) :: errorid character(kind=c_char, len=1001) :: errormessage end type type(utderror_t), bind(c), save :: utderror_v interface subroutine add_utd_error(ierror) bind(c) use iso_c_binding implicit none integer(c_int), intent(out) :: ierror end subroutine end interface end module =============================================================================== I get: =============================================================================== typedef struct utderror_t { int projectid; int txantennaid; int rxantennaid; int pathid; int frequencysetid; int frequencyid; int errornumber; int nerrorloc; double errorstartloc[3]; double errorendloc[3]; char errorsubsystem; char errorseverity; int errorid; char errormessage; } utderror_t; void add_utd_error (int *ierror); typedef struct utderror_t { int projectid; int txantennaid; int rxantennaid; int pathid; int frequencysetid; int frequencyid; int errornumber; int nerrorloc; double errorstartloc[3]; double errorendloc[3]; char errorsubsystem; char errorseverity; int errorid; char errormessage; } utderror_t; void add_utd_error (int *ierror); extern utderror_t utderror_v; extern utderror_t utderror_v; =============================================================================== I think the strings should be char errorsubsystem[41]; char errorseverity[9]; int errorid; char errormessage[1001]; If I do this by hand things work out. Ed