Fwd: [Patch, libfortran] PR 40812 Large file support on MinGW

Janne Blomqvist blomqvist.janne@gmail.com
Tue Dec 1 18:40:00 GMT 2009


Hi,

this accidentally went to gcc@ instead of fortran@..


---------- Forwarded message ----------
From: Janne Blomqvist <blomqvist.janne@gmail.com>
Date: Tue, Dec 1, 2009 at 20:18
Subject: [Patch, libfortran] PR 40812 Large file support on MinGW
To: gcc mailing list <gcc@gcc.gnu.org>, GCC Patches <gcc-patches@gcc.gnu.org>


Hi,

the attached patch should make gfortran support > 2 GB files on MinGW.
I don't have a windows installation to test on, so I don't know if
this works or not. Though I regtested on x86_64-unknown-linux-gnu to
make sure that non-MinGW targets didn't change (it's all behind
#ifdefs, but just to be sure).

Another caveat is that it uses features from the Win32 API that
according to MSDN are available only as of w2k and newer, so with this
patch we effectively drop support for pre-w2k targets on MinGW. I
don't know if anybody cares about such platforms any longer, if so
maybe the interested party could step up to the plate and contribute
some configure checks or somesuch so that we could fall back to the
old ftruncate or chsize functions?

Ok for trunk?

2009-12-01  Janne Blomqvist  <jb@gcc.gnu.org>

       PR libfortran/40812
       * libgfortran.h: typedef gfc_offset differently for mingw.
       * io/unix.h (struct stream): Change function pointers to use
       gfc_offset instead of off_t.
       (sseek): Change prototype to use gfc_offset instead of off_t.
       (stell): Likewise.
       (struncate): Likewise.
       * io/unix.c: Redefine lseek() for mingw.
       (raw_seek): Use gfc_offset instead of off_t.
       (raw_tell): Likewise.
       (buf_seek): Likewise.
       (buf_tell): Likewise.
       (buf_truncate): Likewise.
       (mem_seek): Likewise.
       (mem_tell): Likewise.
       (mem_truncate): Likewise.
       (fd_to_stream): Likewise.
       (file_length): Likewise.
       (raw_truncate): Use gfc_offset instead of off_t, add large file
       capable implementation for MinGW.


--
Janne Blomqvist



-- 
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mingw-lfs.diff
Type: text/x-patch
Size: 5519 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091201/e075e58e/attachment.bin>


More information about the Fortran mailing list