public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40812]  New: Incorrectly writes/reads formatted ASCII files greater than 2Gb
@ 2009-07-20 23:19 apotapov at math dot ualberta dot ca
  2009-07-21  0:01 ` [Bug fortran/40812] " kargl at gcc dot gnu dot org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: apotapov at math dot ualberta dot ca @ 2009-07-20 23:19 UTC (permalink / raw)
  To: gcc-bugs

1) Incorrect writing of formated files: 

      nrp = 70 000 000
      open(1, file = 'tst.dat')
      do i = 1, nrp
         write(1, '(6i10)') (i, k=1,6)
      enddo
      close(1)
      end

When file size reaches 2Gb, the last record is not added to file, but
overwrites the previous one. As a result, the second half of information is
lost.

Incorrect reading. When the previous code has bee compiled with Absoft
compiler, and the tst.dat file has been correctly created, the following code
has beed compiled with gfortran and run.

      integer rd(6)
      nrp = 70 000 000
      open(1, file = 'tst.dat')
      do i = 1, nrp
         read(1, '(6i10)') rd
         do k = 1, 6
            if (rd(k) /= i) then
               write(*,*) i
               write(*,*) rd
               stop
            endif
         enddo
      enddo
      close(1)
      end

It has reported error reading record 34636835. The read line was:
    34636835      346334           0           0           0           0
Therefore, it is impossible to read files greater than 2 Gb.


-- 
           Summary: Incorrectly writes/reads formatted ASCII files greater
                    than 2Gb
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: apotapov at math dot ualberta dot ca
 GCC build triplet: Same
  GCC host triplet: Windows XP Pro, Core2Quad Q6600,  2Gb RAM
GCC target triplet: Same


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Incorrectly writes/reads formatted ASCII files greater than 2Gb
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
@ 2009-07-21  0:01 ` kargl at gcc dot gnu dot org
  2009-07-21  0:12 ` apotapov at math dot ualberta dot ca
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-07-21  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2009-07-21 00:01 -------
What's the output to 'gfortran -v'?

Since you said it's a 2 GB file size problem, I modified your
program to 

      nrp = huge(nrp) / 60
      open(1, file = 'tst.dat')
      do i = 1, nrp+1
         write(1, '(6i10)') (i, k=1,6)
      end do
      close(1)
      end

gfc4x -o z -O big.f90
./z

produces

-rw-r--r--  1 sgk  sgk  - 2183275095 Jul 20 16:55 tst.dat

The last 10 lines are

troutmask:sgk[223] tail tst.dat
  35791386  35791386  35791386  35791386  35791386  35791386
  35791387  35791387  35791387  35791387  35791387  35791387
  35791388  35791388  35791388  35791388  35791388  35791388
  35791389  35791389  35791389  35791389  35791389  35791389
  35791390  35791390  35791390  35791390  35791390  35791390
  35791391  35791391  35791391  35791391  35791391  35791391
  35791392  35791392  35791392  35791392  35791392  35791392
  35791393  35791393  35791393  35791393  35791393  35791393
  35791394  35791394  35791394  35791394  35791394  35791394
  35791395  35791395  35791395  35791395  35791395  35791395

This is on x86_64-*-freebsd.  Looks like it might be a 
MingW or Cywin issue.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Incorrectly writes/reads formatted ASCII files greater than 2Gb
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
  2009-07-21  0:01 ` [Bug fortran/40812] " kargl at gcc dot gnu dot org
@ 2009-07-21  0:12 ` apotapov at math dot ualberta dot ca
  2009-07-21  5:05 ` jvdelisle at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: apotapov at math dot ualberta dot ca @ 2009-07-21  0:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from apotapov at math dot ualberta dot ca  2009-07-21 00:12 -------
Subject: Re:  Incorrectly writes/reads formatted ASCII files greater than 2Gb

The output for gfortran -v is

gfortran -v try.f
Driving: E:\Program Files\gfortran\bin\gfortran.EXE -v 
try.f -lgfortranbegin -lgfortran
Using built-in specs.
Target: i586-pc-mingw32
Configured with: 
../gcc-trunk/configure --prefix=/mingw --enable-languages=c,fortran
--with-gmp=/home/FX/gfortran/dependencies 
 -
-disable-werror --enable-threads --disable-nls --build=i586-pc-mingw32
--enable-libgomp 
 --disable-shared --disable-win32-registr
y --with-dwarf2 --disable-sjlj-exceptions
Thread model: win32
gcc version 4.5.0 20090421 (experimental) [trunk revision 146519] (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=pentium'
 e:/program files/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.5.0/f951.exe 
try.f -ffixed-form -quiet -dumpbase try.f -mtune=pe
ntium -auxbase try -version -fintrinsic-modules-path e:/program 
files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0/finclude -o
E:\DOCUME~1\ALEX-L~1\LOCALS~1\Temp\ccRXXkfW.s
GNU Fortran (GCC) version 4.5.0 20090421 (experimental) [trunk revision 
146519] (i586-pc-mingw32)
        compiled by GNU C version 4.5.0 20090421 (experimental) [trunk 
revision 146519], GMP version 4.3, MPFR version 2.4.1-p5.

warning: GMP header version 4.3 differs from library version 4.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.5.0 20090421 (experimental) [trunk revision 
146519] (i586-pc-mingw32)
        compiled by GNU C version 4.5.0 20090421 (experimental) [trunk 
revision 146519], GMP version 4.3, MPFR version 2.4.1-p5.

warning: GMP header version 4.3 differs from library version 4.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-v' '-mtune=pentium'
 as -o E:\DOCUME~1\ALEX-L~1\LOCALS~1\Temp\cc7YRxVV.o 
E:\DOCUME~1\ALEX-L~1\LOCALS~1\Temp\ccRXXkfW.s
COMPILER_PATH=e:/program 
files/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.5.0/;e:/program 
files/gfortran/bin/../libexec/gcc/
LIBRARY_PATH=e:/program 
files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0/;e:/program 
files/gfortran/bin/../lib/gcc/;e:/progra
m files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0/../../../;/mingw/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=pentium'
 e:/program 
files/gfortran/bin/../libexec/gcc/i586-pc-mingw32/4.5.0/collect2.exe -Bdynamic 
e:/program files/gfortran/bin/../lib/
gcc/i586-pc-mingw32/4.5.0/../../../crt2.o e:/program 
files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0/crtbegin.o -Le:/program
 files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0 -Le:/program 
files/gfortran/bin/../lib/gcc -Le:/program files/gfortran/bin/
../lib/gcc/i586-pc-mingw32/4.5.0/../../.. -L/mingw/lib 
E:\DOCUME~1\ALEX-L~1\LOCALS~1\Temp\cc7YRxVV.o -lgfortranbegin -lgfortran
-lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 
 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lms
vcrt e:/program files/gfortran/bin/../lib/gcc/i586-pc-mingw32/4.5.0/crtend.o


Thanks,
Alex



----- Original Message ----- 
From: "kargl at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: <apotapov@math.ualberta.ca>
Sent: Monday, July 20, 2009 6:01 PM
Subject: [Bug fortran/40812] Incorrectly writes/reads formatted ASCII files 
greater than 2Gb


>
>
> ------- Comment #1 from kargl at gcc dot gnu dot org  2009-07-21 
> 00:01 -------
> What's the output to 'gfortran -v'?
>
> Since you said it's a 2 GB file size problem, I modified your
> program to
>
>      nrp = huge(nrp) / 60
>      open(1, file = 'tst.dat')
>      do i = 1, nrp+1
>         write(1, '(6i10)') (i, k=1,6)
>      end do
>      close(1)
>      end
>
> gfc4x -o z -O big.f90
> ./z
>
> produces
>
> -rw-r--r--  1 sgk  sgk  - 2183275095 Jul 20 16:55 tst.dat
>
> The last 10 lines are
>
> troutmask:sgk[223] tail tst.dat
>  35791386  35791386  35791386  35791386  35791386  35791386
>  35791387  35791387  35791387  35791387  35791387  35791387
>  35791388  35791388  35791388  35791388  35791388  35791388
>  35791389  35791389  35791389  35791389  35791389  35791389
>  35791390  35791390  35791390  35791390  35791390  35791390
>  35791391  35791391  35791391  35791391  35791391  35791391
>  35791392  35791392  35791392  35791392  35791392  35791392
>  35791393  35791393  35791393  35791393  35791393  35791393
>  35791394  35791394  35791394  35791394  35791394  35791394
>  35791395  35791395  35791395  35791395  35791395  35791395
>
> This is on x86_64-*-freebsd.  Looks like it might be a
> MingW or Cywin issue.
>
>
> -- 
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40812
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> 


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Incorrectly writes/reads formatted ASCII files greater than 2Gb
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
  2009-07-21  0:01 ` [Bug fortran/40812] " kargl at gcc dot gnu dot org
  2009-07-21  0:12 ` apotapov at math dot ualberta dot ca
@ 2009-07-21  5:05 ` jvdelisle at gcc dot gnu dot org
  2009-07-21  8:06 ` burnus at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-07-21  5:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2009-07-21 05:04 -------
Works OK on i86-64-linux.  I also ran the original test programs on Cygwin and
results are also OK all the way through.

I wonder if we can get another mingw attempt

Note: 4 Gb file here.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Incorrectly writes/reads formatted ASCII files greater than 2Gb
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (2 preceding siblings ...)
  2009-07-21  5:05 ` jvdelisle at gcc dot gnu dot org
@ 2009-07-21  8:06 ` burnus at gcc dot gnu dot org
  2009-09-05 10:11 ` [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw fxcoudert at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-07-21  8:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2009-07-21 08:06 -------
Also works with -m32 (= i386) on x86-64-linux. (For completeness: There is a
2GB problem for FTELL, cf. PR 39654, due to the ABI.)


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (3 preceding siblings ...)
  2009-07-21  8:06 ` burnus at gcc dot gnu dot org
@ 2009-09-05 10:11 ` fxcoudert at gcc dot gnu dot org
  2009-09-06 18:08 ` ktietz at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-09-05 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2009-09-05 10:10 -------
I can confirm the issue with Steve's testcase on a (i686-darwin) to
(i586-pc-mingw32) cross-compiler, at trunk revision 151373. The issue can even
be seen while running the compiled program under wine, which should make it
rather easy to reproduce without having to deal with Windows :)

I even have a simplified testcase, with one big write (and no CPU consumption
dealing with integer formating):

  implicit none
  character(len=1024*1024), parameter :: mb = ""
  integer :: i

  open(1, file = 't2.dat')
  write (1,"(A)") (mb, i = 1, 2*1024 + 100)
  close(1)
  end

$ ls -l t2*
-rw-r--r--  1 fx  staff  2252343396 Sep  5 12:05 t2-darwin.dat
-rw-r--r--  1 fx  staff  2251296966 Sep  5 12:06 t2-mingw.dat

where t2-darwin.dat is produced by the darwin executable, and t2.dat is
produced by the mingw executable. Please note: the sizes should actually not be
equal, but t2-mingw.dat should have exactly 2148 more bytes (= 2*1024 + 100)
because mingw has CR+LF line endings.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|Same                        |
   GCC host triplet|Windows XP Pro, Core2Quad   |
                   |Q6600,  2Gb RAM             |
 GCC target triplet|Same                        |i586-pc-mingw32
           Keywords|                            |wrong-code
      Known to fail|                            |4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-09-05 10:10:54
               date|                            |
            Summary|Incorrectly writes/reads    |Files > 2GB are incorrectly
                   |formatted ASCII files       |handled on mingw
                   |greater than 2Gb            |


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (4 preceding siblings ...)
  2009-09-05 10:11 ` [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw fxcoudert at gcc dot gnu dot org
@ 2009-09-06 18:08 ` ktietz at gcc dot gnu dot org
  2009-09-06 18:45 ` kargl at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-09-06 18:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ktietz at gcc dot gnu dot org  2009-09-06 18:07 -------
I think I found the issue within gfortran for mingw. The issue is that off_t is
for mingw defined as 'long' (like _off_t). There is a 64-bit off64_t, which
holds in fact 64-bits and can be used with the ftello64, and fseeko64
functions.

Cheers,
Kai


-- 

ktietz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at gcc dot gnu dot
                   |                            |org


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (5 preceding siblings ...)
  2009-09-06 18:08 ` ktietz at gcc dot gnu dot org
@ 2009-09-06 18:45 ` kargl at gcc dot gnu dot org
  2009-09-06 18:52 ` ktietz at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-09-06 18:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kargl at gcc dot gnu dot org  2009-09-06 18:45 -------
(In reply to comment #6)
> I think I found the issue within gfortran for mingw.

I think you have this backwards.  "the issue within mingw
for gfortran" would be a better description of the issue.
It is afterall mingw that defines off_t.

-- 
steve


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (6 preceding siblings ...)
  2009-09-06 18:45 ` kargl at gcc dot gnu dot org
@ 2009-09-06 18:52 ` ktietz at gcc dot gnu dot org
  2009-09-06 19:09 ` kargl at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-09-06 18:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ktietz at gcc dot gnu dot org  2009-09-06 18:52 -------
(In reply to comment #7)
> (In reply to comment #6)
> > I think I found the issue within gfortran for mingw.
> 
> I think you have this backwards.  "the issue within mingw
> for gfortran" would be a better description of the issue.
> It is afterall mingw that defines off_t.
> 
> -- 
> steve
> 

Well, in fact it is MS here. But we on mingw-w64 think at the moment about to
add an override option for this by defining _LARGE_FILES. But we have to plan
this in more detail. Would this be an option for you?


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (7 preceding siblings ...)
  2009-09-06 18:52 ` ktietz at gcc dot gnu dot org
@ 2009-09-06 19:09 ` kargl at gcc dot gnu dot org
  2009-09-06 20:05 ` ktietz at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: kargl at gcc dot gnu dot org @ 2009-09-06 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from kargl at gcc dot gnu dot org  2009-09-06 19:09 -------
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > I think I found the issue within gfortran for mingw.
> > 
> > I think you have this backwards.  "the issue within mingw
> > for gfortran" would be a better description of the issue.
> > It is afterall mingw that defines off_t.
> > 
> 
> Well, in fact it is MS here. But we on mingw-w64 think at the moment about to
> add an override option for this by defining _LARGE_FILES. But we have to plan
> this in more detail. Would this be an option for you?
> 

If the changes are confined to libgfortran, then I suspect that the
above would be acceptable (although I haven't worked on libgfortran
recently); as long as the changes can be wrapped in '#define __MINGW__'
(or an equivalent).  If front-end changes are required, then that would
be much more difficult to accommodate.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (8 preceding siblings ...)
  2009-09-06 19:09 ` kargl at gcc dot gnu dot org
@ 2009-09-06 20:05 ` ktietz at gcc dot gnu dot org
  2009-09-07 23:58 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-09-06 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from ktietz at gcc dot gnu dot org  2009-09-06 20:05 -------
(In reply to comment #9)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > (In reply to comment #6)
> > > > I think I found the issue within gfortran for mingw.
> > > 
> > > I think you have this backwards.  "the issue within mingw
> > > for gfortran" would be a better description of the issue.
> > > It is afterall mingw that defines off_t.
> > > 
> > 
> > Well, in fact it is MS here. But we on mingw-w64 think at the moment about to
> > add an override option for this by defining _LARGE_FILES. But we have to plan
> > this in more detail. Would this be an option for you?
> > 
> 
> If the changes are confined to libgfortran, then I suspect that the
> above would be acceptable (although I haven't worked on libgfortran
> recently); as long as the changes can be wrapped in '#define __MINGW__'
> (or an equivalent).  If front-end changes are required, then that would
> be much more difficult to accommodate.
> 

Sorry, I think you misunderstand the suggestion I did. I said that we would
allow by defining _LARGE_FILES, that off_t (and ftell, fseek) are defined as
POSIX. You have to notice that Windows (and in special mingw targets) aren't
POSIX. They are Windows native targets, which have to live with the API MS
defines. If the suggested suggestion isn't acceptable, well then files > 2GB
won't run for gfortran, sorry.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (9 preceding siblings ...)
  2009-09-06 20:05 ` ktietz at gcc dot gnu dot org
@ 2009-09-07 23:58 ` jvdelisle at gcc dot gnu dot org
  2009-09-08  7:21 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-09-07 23:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jvdelisle at gcc dot gnu dot org  2009-09-07 23:58 -------
I worked on some of the current large file defines in libgfortran.  Show me a
patch of what you want to do.  It should be OK.  A patch is worth a thousand
words.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (10 preceding siblings ...)
  2009-09-07 23:58 ` jvdelisle at gcc dot gnu dot org
@ 2009-09-08  7:21 ` burnus at gcc dot gnu dot org
  2009-09-13  8:19 ` ktietz at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-09-08  7:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from burnus at gcc dot gnu dot org  2009-09-08 07:21 -------
> > Well, in fact it is MS here. But we on mingw-w64 think at the moment about 
> > to add an override option for this by defining _LARGE_FILES

(In reply to comment #11)
> I worked on some of the current large file defines in libgfortran.

I think there are two options:

a) libgfortran handles Windows large-file support explicitly, i.e. uses
off64_t, ftello64, fseeko64 explicitly. (For truncation [cf. backspace on
writing], one might need to do fseeko64 + SetEndOfFile(HANDLE).)

b) MinGW maps off_t to off64_t etc. when using the -D_FILE_OFFSET_BITS=64
similar to (some) Unix.

I think (b) would automatically enable large-file support for libgfortran; Kai
will discuss this with other MinGW developers.
(a) would be an option independent of MinGW changes.

The plan was to wait for the result of the discussion regarding the MinGW
changes before continuing here.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (11 preceding siblings ...)
  2009-09-08  7:21 ` burnus at gcc dot gnu dot org
@ 2009-09-13  8:19 ` ktietz at gcc dot gnu dot org
  2009-12-01 16:21 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-09-13  8:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from ktietz at gcc dot gnu dot org  2009-09-13 08:19 -------
(In reply to comment #12)
> > > Well, in fact it is MS here. But we on mingw-w64 think at the moment about 
> > > to add an override option for this by defining _LARGE_FILES
> 
> (In reply to comment #11)
> > I worked on some of the current large file defines in libgfortran.
> 
> I think there are two options:
> 
> a) libgfortran handles Windows large-file support explicitly, i.e. uses
> off64_t, ftello64, fseeko64 explicitly. (For truncation [cf. backspace on
> writing], one might need to do fseeko64 + SetEndOfFile(HANDLE).)
> 
> b) MinGW maps off_t to off64_t etc. when using the -D_FILE_OFFSET_BITS=64
> similar to (some) Unix.
> 
> I think (b) would automatically enable large-file support for libgfortran; Kai
> will discuss this with other MinGW developers.
> (a) would be an option independent of MinGW changes.
> 
> The plan was to wait for the result of the discussion regarding the MinGW
> changes before continuing here.
> 

Hello,

I spoke in team of mingw-w64 and with some of the team of mingw.org about this
issue. On one hand, we have to agree that this kind of feature would ease
porting of POSIX sources to windows, on the other we see here issues in general
compatibility for native win32 applications and wrong assumptions of users
about POSIX and windows native runtime. So we decided for now, that we won't
introduce this macro magic, and it would be best that libgfortran does this
porting for native windows by themself.

Cheers,
Kai


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (12 preceding siblings ...)
  2009-09-13  8:19 ` ktietz at gcc dot gnu dot org
@ 2009-12-01 16:21 ` burnus at gcc dot gnu dot org
  2009-12-01 17:08 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-01 16:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from burnus at gcc dot gnu dot org  2009-12-01 16:21 -------
Some further notes based on the discussion with Kai:

ftruncate: Replace by a configure check for "ftruncate64" and a fallback using
first "SetFilePointer" and then "SetEndOfFile(_get_osfhandle(fd))". Note: The
function SetFilePointer has no more interpretations and checks before, so you
avoid failure-cases in C-runtime. (Thus one may need to handle errno/error
processing manually -> "ierrno()" intrinsic.) See MSDN, e.g. for SetEndOfFile:
  http://msdn.microsoft.com/en-us/library/aa365541%28VS.85%29.aspx

off_t: Replace by _off64_t

lseek: Replace by _lseeki64

(_telli64 also is supported, but I think we do not use it.)

io.h contains the _* functions prototypes and windows.h the Set* functions.

Checking for #ifdef __MINGW32__ should be enough for MinGW(.org|64).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu dot org
   Last reconfirmed|2009-09-05 10:10:54         |2009-12-01 16:21:16
               date|                            |


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (13 preceding siblings ...)
  2009-12-01 16:21 ` burnus at gcc dot gnu dot org
@ 2009-12-01 17:08 ` burnus at gcc dot gnu dot org
  2009-12-01 17:59 ` [Bug libfortran/40812] " jb at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-01 17:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from burnus at gcc dot gnu dot org  2009-12-01 17:08 -------
Regarding the ftruncate(64) fall back: one should check that it doesn't operate
on none character devices (isatty) and set errno to something like EBADF.


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug libfortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (14 preceding siblings ...)
  2009-12-01 17:08 ` burnus at gcc dot gnu dot org
@ 2009-12-01 17:59 ` jb at gcc dot gnu dot org
  2009-12-01 18:39 ` jb at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-01 17:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jb at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
          Component|fortran                     |libfortran
   Last reconfirmed|2009-12-01 16:21:16         |2009-12-01 17:59:33
               date|                            |


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug libfortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (15 preceding siblings ...)
  2009-12-01 17:59 ` [Bug libfortran/40812] " jb at gcc dot gnu dot org
@ 2009-12-01 18:39 ` jb at gcc dot gnu dot org
  2009-12-01 18:58 ` jb at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-01 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jb at gcc dot gnu dot org  2009-12-01 18:39 -------
Patch


-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2009-
                   |                            |12/msg00081.html


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug libfortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (16 preceding siblings ...)
  2009-12-01 18:39 ` jb at gcc dot gnu dot org
@ 2009-12-01 18:58 ` jb at gcc dot gnu dot org
  2009-12-04 16:29 ` jb at gcc dot gnu dot org
  2009-12-04 17:02 ` jb at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-01 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jb at gcc dot gnu dot org  2009-12-01 18:58 -------
Updated patch: http://gcc.gnu.org/ml/fortran/2009-12/msg00017.html


-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://gcc.gnu.org/ml/gcc-  |http://gcc.gnu.org/ml/fortra
                   |patches/2009-               |n/2009-12/msg00017.html
                   |12/msg00081.html            |


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug libfortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (17 preceding siblings ...)
  2009-12-01 18:58 ` jb at gcc dot gnu dot org
@ 2009-12-04 16:29 ` jb at gcc dot gnu dot org
  2009-12-04 17:02 ` jb at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-04 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jb at gcc dot gnu dot org  2009-12-04 16:28 -------
Subject: Bug 40812

Author: jb
Date: Fri Dec  4 16:28:44 2009
New Revision: 154984

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154984
Log:
PR libfortran/40812 Large file support for MinGW

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/unix.c
    trunk/libgfortran/io/unix.h
    trunk/libgfortran/libgfortran.h


-- 


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug libfortran/40812] Files > 2GB are incorrectly handled on mingw
  2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
                   ` (18 preceding siblings ...)
  2009-12-04 16:29 ` jb at gcc dot gnu dot org
@ 2009-12-04 17:02 ` jb at gcc dot gnu dot org
  19 siblings, 0 replies; 21+ messages in thread
From: jb at gcc dot gnu dot org @ 2009-12-04 17:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from jb at gcc dot gnu dot org  2009-12-04 17:02 -------
Fixed, closing.


-- 

jb at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-12-04 17:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-20 23:19 [Bug fortran/40812] New: Incorrectly writes/reads formatted ASCII files greater than 2Gb apotapov at math dot ualberta dot ca
2009-07-21  0:01 ` [Bug fortran/40812] " kargl at gcc dot gnu dot org
2009-07-21  0:12 ` apotapov at math dot ualberta dot ca
2009-07-21  5:05 ` jvdelisle at gcc dot gnu dot org
2009-07-21  8:06 ` burnus at gcc dot gnu dot org
2009-09-05 10:11 ` [Bug fortran/40812] Files > 2GB are incorrectly handled on mingw fxcoudert at gcc dot gnu dot org
2009-09-06 18:08 ` ktietz at gcc dot gnu dot org
2009-09-06 18:45 ` kargl at gcc dot gnu dot org
2009-09-06 18:52 ` ktietz at gcc dot gnu dot org
2009-09-06 19:09 ` kargl at gcc dot gnu dot org
2009-09-06 20:05 ` ktietz at gcc dot gnu dot org
2009-09-07 23:58 ` jvdelisle at gcc dot gnu dot org
2009-09-08  7:21 ` burnus at gcc dot gnu dot org
2009-09-13  8:19 ` ktietz at gcc dot gnu dot org
2009-12-01 16:21 ` burnus at gcc dot gnu dot org
2009-12-01 17:08 ` burnus at gcc dot gnu dot org
2009-12-01 17:59 ` [Bug libfortran/40812] " jb at gcc dot gnu dot org
2009-12-01 18:39 ` jb at gcc dot gnu dot org
2009-12-01 18:58 ` jb at gcc dot gnu dot org
2009-12-04 16:29 ` jb at gcc dot gnu dot org
2009-12-04 17:02 ` jb at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).