[PATCH,Fortran] Fix libgfortran/io/close.c for !HAVE_UNLINK_OPEN_FILE
Janne Blomqvist
blomqvist.janne@gmail.com
Tue Oct 2 15:55:00 GMT 2018
On Tue, Oct 2, 2018 at 2:08 PM Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Revision r215307 | jb | 2014-09-16 23:40:28 +0200 (Di, 16 Sep 2014)
>
> PR libfortran/62768 Handle filenames with embedded null characters.
> :
>
> made the changes like the following to libgfortran/io/close.c
>
> #if !HAVE_UNLINK_OPEN_FILE
> - path = fc_strdup (u->file, u->file_len);
> + path = strdup (u->filename);
> #endif
>
>
> One of our users now reported this build failure for a system where
> (for whatever reason) HAVE_UNLINK_OPEN_FILE is not defined:
>
> .../GCC-HEAD/libgfortran/io/close.c:94:11: error: implicit declaration
> of function ‘strdup’
> 94 | path = strdup (u->filename);
> | ^~~~~~
>
>
> By #undef-ining HAVE_UNLINK_OPEN_FILE beetween the #include "..." and
> #include <...> statements in libgfortran/io/close.c I could reproduce
> this on FreeBSD 11/i386.
>
> And I could validate the fix below, both with and without that #undef
> in place.
>
>
> Tested on i386-unknown-freebsd11.1.
>
>
> Okay to commit?
>
> I'd also like to apply this to older release branches (down to GCC 6)
> since it is obviously broken and the fix appears straightforward. If
> approved, I'm thinking to wait about a week or two before making each
> step backwards (from HEAD to 8, 8 to 7, and 7 to 6).
>
> Gerald
>
Ok, thanks!
--
Janne Blomqvist
More information about the Fortran
mailing list