This is the mail archive of the gcc-bugs@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]

[Bug libfortran/42420] New: libgfortran fails to open large files on MINGW32


Program bigfile
  open( 1,file='bigfile',position='append')
End program bigfile

fails if size of the bigfile is > 2GB. This is due to
the struct stat holding 32 bit st_size field in this
platform. The following fix worked for me
(libgfortran/io/...)

Index: unix.c
===================================================================
--- unix.c      (revision 155325)
+++ unix.c      (working copy)
@@ -781,7 +781,11 @@
 static stream *
 fd_to_stream (int fd, int prot)
 {
+#ifdef __MINGW32__
+  struct _stati64 statbuf;
+#else
   struct stat statbuf;
+#endif
   unix_stream *s;

   s = get_mem (sizeof (unix_stream));
@@ -795,7 +799,11 @@

   /* Get the current length of the file. */

+#ifdef __MINGW32__
   fstat (fd, &statbuf);
+#else
+  _fstati64 (fd, &statbuf);
+#endif

   if (lseek (fd, 0, SEEK_CUR) == (gfc_offset) -1)
     s->file_length = -1;

Juha


-- 
           Summary: libgfortran fails to open large files on MINGW32
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jpr at csc dot fi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42420


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