[Bug fortran/44698] I/O: FLUSH does not actually flush the buffer?

jvdelisle at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jun 29 05:32:00 GMT 2010



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2010-06-29 05:32 -------
One possible cause of this problem is that in configuration there could be
something going wrong with stat functions returning 32-bit vs 64-bit values.  I
found one thread where C++ code was using 32-bit versions of calls even though
LARGE_FILE support had been enabled. In inquire.c (filesize) we are casting to
a 64-bit result.

return (GFC_IO_INT) statbuf.st_size;

Another possibility is that according to this:

http://msdn.microsoft.com/en-us/library/14h5k7ff%28VS.71%29.aspx

The required header when using stati64 as we are in io/unix.c for mingw is:

<sys/types.h> followed by <sys/stat.h>

I do not see <sys/types.h> included.  Is it implied by windows.h? Maybe we need
to fix this here:

/* Unix stream I/O module */

#include "io.h"
#include "unix.h"
#include <stdlib.h>
#include <limits.h>

#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>

#include <string.h>
#include <errno.h>


/* For mingw, we don't identify files by their inode number, but by a
   64-bit identifier created from a BY_HANDLE_FILE_INFORMATION. */
#ifdef __MINGW32__

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#define lseek _lseeki64
#define fstat _fstati64
#define stat _stati64
typedef struct _stati64 gfstat_t;


-- 


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



More information about the Gcc-bugs mailing list