This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR libfortran/62768] Handle filenames with embedded nulls
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: FX <fxcoudert at gmail dot com>, Fortran List <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 17 Sep 2014 14:27:22 +0300
- Subject: Re: [PR libfortran/62768] Handle filenames with embedded nulls
- Authentication-results: sourceware.org; auth=none
- References: <CAO9iq9E75dJ2AEMfnB_Ro68FBEpYz=BjS2-fxqWNUznbCtpH+Q at mail dot gmail dot com> <CAO9iq9GP7x_sYFAzRYZryw8LEJxSBY_nrXcHHQG+BQPGJTFcZQ at mail dot gmail dot com> <F7035948-4928-4A65-90DF-1B12D7316FEB at gmail dot com> <CAO9iq9EENvbr-BSEOPZeV9325xn8=GX02z8y46_6cvHvL9-weg at mail dot gmail dot com> <alpine dot BSF dot 2 dot 02 dot 1409170720140 dot 97960 at arjuna dot pair dot com>
On Wed, Sep 17, 2014 at 2:22 PM, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On Wed, 17 Sep 2014, Janne Blomqvist wrote:
>> On Tue, Sep 16, 2014 at 11:17 AM, FX <fxcoudert@gmail.com> wrote:
>> >>> 2014-09-05 Janne Blomqvist <jb@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.
>> >
>> > OK, if you add a runtime testcase.
>>
>> Thanks for the review, committed as r215307.
>
> Something went wrong. For cris-elf:
>
> libtool: compile: /tmp/hpautotest-gcc1/cris-elf/gccobj/./gcc/xgcc -B/tmp/hpautotest-gcc1/cris-elf/gccobj/./gcc/ -nostdinc -B/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/newlib/ -isystem /tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/newlib/targ-include -isystem /tmp/hpautotest-gcc1/gcc/newlib/libc/include -B/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/libgloss/cris -L/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/libgloss/libnosys -L/tmp/hpautotest-gcc1/gcc/libgloss/cris -B/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/bin/ -B/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/lib/ -isystem /tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/include -isystem /tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/sys-include -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-gcc1/gcc/libgfortran -iquote/tmp/hpautotest-gcc1/gcc/libgfortran/io -I/tmp/hpautotest-gcc1/gcc/libgfortran/../gcc -I/tmp/hpautotest-gcc1/gcc/libgfortran/../gcc/config -I../.././gcc -I/tmp/hpautotest-gcc1/gcc/libgfortran/../libgcc -I../libgcc -std=gnu11 -Wall
> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -fcx-fortran-rules -ffunction-sections -fdata-sections -g -O2 -MT inquire.lo -MD -MP -MF .deps/inquire.Tpo -c /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c -o inquire.o
> /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c: In function 'inquire_via_unit':
> /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c:97:41: error: 'gfc_unit' has no member named 'file'
> fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> ^
> /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c:97:50: error: 'gfc_unit' has no member named 'file_len'
> fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> ^
> make[3]: *** [inquire.lo] Error 1
>
> brgds, H-P
Oops, I forgot to update some parts in an #ifdef branch that isn't
taken on my target. I'll try to find time to fix it later tonight. If
you're in a hurry, just replace
fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
with
cf_strcpy (iqp->name, iqp->name_len, u->filename);
in inquire.c.
--
Janne Blomqvist