This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR libfortran/62768] Handle filenames with embedded nulls


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]