https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65563
Mikael Morin <mikael at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> --- Maybe this works? Index: io/open.c =================================================================== --- io/open.c (révision 221654) +++ io/open.c (copie de travail) @@ -595,6 +595,8 @@ new_unit (st_parameter_open *opp, gfc_unit *u, uni u->strm_pos = stell (u->s) + 1; } + free (u->filename); + u->filename = NULL; u->filename = fc_strdup (opp->file, opp->file_len); /* Curiously, the standard requires that the @@ -666,8 +668,6 @@ already_open (st_parameter_open *opp, gfc_unit * u if (u->filename && u->flags.status == STATUS_SCRATCH) unlink (u->filename); #endif - free (u->filename); - u->filename = NULL; u = new_unit (opp, u, flags); if (u != NULL)