https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107441
--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #2)
> 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.
I've found the code generating the function call in gfc_conv_procedure_call
(trans-expr.cc:7680)
/* Add the return arguments. */
vec_safe_splice (retargs, arglist);
/* Add the hidden present status for optional+value to the arguments. */
vec_safe_splice (retargs, optionalargs);
/* Add the hidden string length parameters to the arguments. */
vec_safe_splice (retargs, stringargs);
/* We may want to append extra arguments here. This is used e.g. for
calls to libgfortran_matmul_??, which need extra information. */
vec_safe_splice (retargs, append_args);
We now need the corresponding part on the procedure side.