[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 Janne Blomqvist jb at gcc dot gnu.org changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #9 from Janne Blomqvist jb at gcc dot gnu.org --- Fixed on gcc-5 branch as well, release manager approval at https://gcc.gnu.org/ml/gcc/2015-07/msg00184.html . Closing as fixed, thanks Rainer for reporting the issue and testing!
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #8 from Janne Blomqvist jb at gcc dot gnu.org --- Author: jb Date: Wed Jul 15 07:00:23 2015 New Revision: 225805 URL: https://gcc.gnu.org/viewcvs?rev=225805root=gccview=rev Log: PR 66861 Fix null pointer crash on mingw. 2015-07-15 Janne Blomqvist j...@gcc.gnu.org PR libfortran/66861 * io/unix.c (compare_file_filename): Verify that u-filename is non-NULL before strcmp. (find_file0): Likewise. Modified: branches/gcc-5-branch/libgfortran/ChangeLog branches/gcc-5-branch/libgfortran/io/unix.c
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |5.2
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #5 from Rainer Emrich rai...@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.
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #7 from Janne Blomqvist jb at gcc dot gnu.org --- Fixed on trunk. I'm not sure if the milestone thing implies an Ok to commit to the gcc-5 branch, as we're already on 5.2 rc2, I'll ask explicitly for an Ok.
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #6 from Janne Blomqvist jb at gcc dot gnu.org --- Author: jb Date: Tue Jul 14 20:26:06 2015 New Revision: 225788 URL: https://gcc.gnu.org/viewcvs?rev=225788root=gccview=rev Log: PR 66861 Fix null pointer crash on mingw. 2015-07-14 Janne Blomqvist j...@gcc.gnu.org PR libfortran/66861 * io/unix.c (compare_file_filename): Verify that u-filename is non-NULL before strcmp. (find_file0): Likewise. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/unix.c
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 Janne Blomqvist jb at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2015-07-13 Ever confirmed|0 |1 --- Comment #2 from Janne Blomqvist jb at gcc dot gnu.org --- Hmm, does the following patch fix it? diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index e5fc6e1..0048e24 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1570,7 +1570,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 (Sorry, I don't have a windows machine to test on myself..)
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #3 from Janne Blomqvist jb at gcc dot gnu.org --- 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
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #1 from Rainer Emrich rai...@emrich-ebersheim.de --- I suspect the following commit causing the issue: 215307: File size: 43008 byte(s) PR libfortran/62768 Handle filenames with embedded null characters. testsuite ChangeLog: 2014-09-17 Janne Blomqvist j...@gcc.gnu.org PR libfortran/62768 * gfortran.dg/filename_null.f90: New test. libgfortran ChangeLog: 2014-09-17 Janne Blomqvist j...@gcc.gnu.org PR libfortran/62768 * io/io.h (gfc_unit): Store C string for the filename. * io/close.c (st_close): Use gfc_unit.filename. * io/inquire.c (inquire_via_unit): Likewise. * io/open.c (new_unit): Likewise. (already_open): Likewise, unlink file before freeing filename. * io/unit.c (init_units): Likewise. (close_unit_1): Likewise. (filename_from_unit): Likewise. * io/unix.c (compare_file_filename): Likewise. (find_file0): Likewise. (delete_file): Likewise.
[Bug libfortran/66861] [5/6 Regression] Segmentation fault in gcc/testsuite/gfortran.dg/streamio_5.f90
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #4 from Rainer Emrich rai...@emrich-ebersheim.de --- Am 13.07.2015 um 20:56 schrieb jb at gcc dot gnu.org: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66861 --- Comment #3 from Janne Blomqvist jb at gcc dot gnu.org --- 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 I will test this tomorrow.