https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107441
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #1) > Confirmed. > > There is an inconsistency either in the generated code for the caller or > the callee: > > integer(kind=4) testoptional (character(kind=1)[1:1] & restrict w, > integer(kind=4) x, integer(kind=8) _w, logical(kind=1) _x) > > vs. > > t = testoptional (&s, 0, 0, 1); > > How does the ABI define the ordering of character length and presence flag? Yep, there's an API issue. If you use character(len=13) :: s the produced code is t = testoptional (&s, 0, 0, 13); so the hidden charlen is tacked on last whereas I think the hidden presence argument is also expected to be last. Likely a counting error in generating the interface.