[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
rainer@emrich-ebersheim.de
gcc-bugzilla@gcc.gnu.org
Tue Jul 14 12:30:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861
--- Comment #5 from Rainer Emrich <rainer@emrich-ebersheim.de> ---
(In reply to Janne Blomqvist from comment #3)
> Or rather, also fixing another similar potential issue, you might instead
> want to test this:
>
> diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
> index e5fc6e1..a1ce9a3 100644
> --- a/libgfortran/io/unix.c
> +++ b/libgfortran/io/unix.c
> @@ -1525,7 +1525,10 @@ compare_file_filename (gfc_unit *u, const char *name,
> int len)
> goto done;
> }
> # endif
> - ret = (strcmp(path, u->filename) == 0);
> + if (u->filename)
> + ret = (strcmp(path, u->filename) == 0);
> + else
> + ret = 0;
> #endif
> done:
> free (path);
> @@ -1570,7 +1573,7 @@ find_file0 (gfc_unit *u, FIND_FILE0_DECL)
> }
> else
> # endif
> - if (strcmp (u->filename, path) == 0)
> + if (u->filename && strcmp (u->filename, path) == 0)
> return u;
> #endif
This solves the issue!
Richard set target milestone to 5.2. So I suppose this should go into trunk and
the gcc-5 branch.
More information about the Gcc-bugs
mailing list