This fixes a memory leak by accompanying the release of
gfc_actual_arglist elements' memory with a release of the
associated_dummy field memory (if allocated).
Actual argument copy is adjusted as well so that each copy can free
its field independently.
PR fortran/108923
gcc/fortran/ChangeLog:
* expr.cc (gfc_free_actual_arglist): Free associated_dummy
memory.
(gfc_copy_actual_arglist): Make a copy of the associated_dummy
field if it is set in the original element.
a2 = a1->next;
if (a1->expr)
gfc_free_expr (a1->expr);
+ free (a1->associated_dummy);
free (a1);
a1 = a2;
}
new_arg = gfc_get_actual_arglist ();
*new_arg = *p;
+ if (p->associated_dummy != NULL)
+ {
+ new_arg->associated_dummy = gfc_get_dummy_arg ();
+ *new_arg->associated_dummy = *p->associated_dummy;
+ }
+
new_arg->expr = gfc_copy_expr (p->expr);
new_arg->next = NULL;