https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78549
--- Comment #12 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This was for trunk.
This patch
Index: io.h
===================================================================
--- io.h (Revision 253377)
+++ io.h (Arbeitskopie)
@@ -773,6 +773,7 @@
extern int newunit_alloc (void);
internal_proto(newunit_alloc);
+extern void delete_unit (gfc_unit *);
/* open.c */
Index: transfer.c
===================================================================
--- transfer.c (Revision 253377)
+++ transfer.c (Arbeitskopie)
@@ -4169,6 +4169,9 @@
free_format (dtp);
}
unlock_unit (dtp->u.p.current_unit);
+
+ if (is_internal_unit (dtp))
+ delete_unit (dtp->u.p.current_unit);
}
library_end ();
}
Index: unit.c
===================================================================
--- unit.c (Revision 253377)
+++ unit.c (Arbeitskopie)
@@ -307,7 +307,7 @@
/* delete_unit()-- Delete a unit from a tree */
-static void
+void
delete_unit (gfc_unit *old)
{
unit_root = delete_treap (old, unit_root);
helps only a little:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
26.26 1.88 1.88 delete_root
15.78 3.01 1.13 build_float_string
5.24 3.39 0.38
formatted_transfer_scalar_write
4.89 3.74 0.35 _gfortrani_parse_format
4.19 4.04 0.30 next_format0
4.12 4.33 0.30 get_float_string
3.77 4.60 0.27 write_float_0
2.51 4.78 0.18 get_precision
2.44 4.96 0.18 data_transfer_init
2.23 5.12 0.16
_gfortrani_free_format_hash_table