http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59599
Mikael Morin <mikael at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> --- in trans-intrinsic's gfc_conv_intrinsic_function_args: if (e->ts.type == BT_CHARACTER) { gfc_conv_expr (&argse, e); gfc_conv_string_parameter (&argse); argarray[curr_arg++] = argse.string_length; gcc_assert (curr_arg < nargs); } we evaluate the string lenth into argarray[curr_arg], but argarray[curr_arg] is supposed to be the place where the next function argument lies. So in the testcase, we don't evaluate the "kind" argument to "ichar" and all hell breaks loose from that.