------- Comment #6 from janus at gcc dot gnu dot org 2009-08-05 14:50 ------- (In reply to comment #2) > > * trans-decl.c (create_function_arglist) > > > > This is OK - the new cl is threaded into the list. > > Actually I think that this is not done properly.
The following should fix it: Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 150482) +++ gcc/fortran/trans-decl.c (working copy) @@ -1796,16 +1796,15 @@ create_function_arglist (gfc_symbol * sy /* This can happen if the same type is used for multiple arguments. We need to copy cl as otherwise cl->passed_length gets overwritten. */ - gfc_charlen *cl, *cl2; + gfc_charlen *cl; cl = f->sym->ts.cl; f->sym->ts.cl = gfc_get_charlen(); f->sym->ts.cl->length = cl->length; f->sym->ts.cl->backend_decl = cl->backend_decl; f->sym->ts.cl->length_from_typespec = cl->length_from_typespec; f->sym->ts.cl->resolved = cl->resolved; - cl2 = f->sym->ts.cl->next; - f->sym->ts.cl->next = cl; - cl->next = cl2; + f->sym->ts.cl->next = cl->next; + cl->next = f->sym->ts.cl; } f->sym->ts.cl->passed_length = length; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40877