https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43849
--- Comment #6 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- (In reply to Tobias Burnus from comment #0) > Currently, _gfortran_abort calls: > close_units (); > Additionally, one should call: > flush_all_units (); close_units() actually flushes all units when closing then. (In reply to Janne Blomqvist from comment #3) > cleanup() in runtime/main.c is marked with the destructor attribute, it will > be > called when the library is unloaded during program shutdown. > > It might make sense to add > > fbuf_flush(u); > sflush(u); Same reply: when we close units, we do flush them. This is already ensured in the close functions of io/unix.c. So, to summarize: we already have a finalization function, cleanup(). Should we export it? I am not so sure, unless we have a real use case.