http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43849
Janne Blomqvist <jb at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jb at gcc dot gnu.org --- Comment #3 from Janne Blomqvist <jb at gcc dot gnu.org> 2010-11-03 16:31:08 UTC --- In runtime/main.c we have static void __attribute__((destructor)) cleanup (void) { close_units (); if (please_free_exe_path_when_done) free ((char *) exe_path); } As this function 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); to some appropriate place in unit.c(close_unit_1). That is, make sure to flush the unit as part of the closing procedure.