public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/23262] New: rewind truncates file
@ 2005-08-06 19:46 fxcoudert at gcc dot gnu dot org
2005-08-07 13:05 ` [Bug libfortran/23262] " fxcoudert at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-06 19:46 UTC (permalink / raw)
To: gcc-bugs
$ cat endfile.f90
integer i
open(unit=10,file='test.dat')
do i=1,5
write (10,'(I4)') i
end do
rewind(10)
close(10)
end
$ gfc endfile.f90 && a && cat test.dat
1
2
3
4
$ xxd test.dat
0000000: 2020 2031 0d0a 2020 2032 0d0a 2020 2033 1.. 2.. 3
0000010: 0d0a 2020 2034 0d0a 20 .. 4..
If you remove the rewind statement, the program behaves correctly, that is we
have a fifth line with " 5" in it.
--
Summary: rewind truncates file
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
@ 2005-08-07 13:05 ` fxcoudert at gcc dot gnu dot org
2005-08-07 15:17 ` [Bug libfortran/23262] rewind truncates file on migwin32 pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-08-07 13:05 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |23261
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] rewind truncates file on migwin32
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
2005-08-07 13:05 ` [Bug libfortran/23262] " fxcoudert at gcc dot gnu dot org
@ 2005-08-07 15:17 ` pinskia at gcc dot gnu dot org
2005-08-07 15:19 ` [Bug libfortran/23262] [migwin32] rewind truncates file pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-07 15:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-07 15:17 -------
Works correctly on i686-pc-linux-gnu.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet| |mingw32
Summary|rewind truncates file |rewind truncates file on
| |migwin32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [migwin32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
2005-08-07 13:05 ` [Bug libfortran/23262] " fxcoudert at gcc dot gnu dot org
2005-08-07 15:17 ` [Bug libfortran/23262] rewind truncates file on migwin32 pinskia at gcc dot gnu dot org
@ 2005-08-07 15:19 ` pinskia at gcc dot gnu dot org
2005-08-07 15:20 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-07 15:19 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|rewind truncates file on |[migwin32] rewind truncates
|migwin32 |file
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [migwin32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-08-07 15:19 ` [Bug libfortran/23262] [migwin32] rewind truncates file pinskia at gcc dot gnu dot org
@ 2005-08-07 15:20 ` pinskia at gcc dot gnu dot org
2005-09-03 8:46 ` fxcoudert at gcc dot gnu dot org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-07 15:20 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|i386-mingw32 |
GCC target triplet|mingw32 |i386-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [migwin32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-08-07 15:20 ` pinskia at gcc dot gnu dot org
@ 2005-09-03 8:46 ` fxcoudert at gcc dot gnu dot org
2005-09-03 10:15 ` fxcoudert at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-03 8:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-03 08:46 -------
Well, that was not so difficult: when we write "1234\n6789\n" for example, the
length of the write is 10. But the size of the resulting file is 12, since each
newline character is translated into a two-byte \n\r sequence! Then, the first
step of the rewind is to truncate the file to length 10.
I don't know exactly how we should handle this :(
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-09-03 08:46:02
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [migwin32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-09-03 8:46 ` fxcoudert at gcc dot gnu dot org
@ 2005-09-03 10:15 ` fxcoudert at gcc dot gnu dot org
2005-09-03 19:09 ` fxcoudert at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-03 10:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-03 10:15 -------
OK, it's worse than I thought. When you open a file with O_BINARY, it is opened
using Unix conventions, and you need to add yourself the \r in the right places.
Otherwise, you can use the Windows CRLF convention, but then lseek and ftruncate
are *not* usable. Not at all.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [migwin32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-09-03 10:15 ` fxcoudert at gcc dot gnu dot org
@ 2005-09-03 19:09 ` fxcoudert at gcc dot gnu dot org
2005-09-04 6:29 ` [Bug libfortran/23262] [mingw32] " fxcoudert at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-03 19:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-03 19:09 -------
*** Bug 23264 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [mingw32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-09-03 19:09 ` fxcoudert at gcc dot gnu dot org
@ 2005-09-04 6:29 ` fxcoudert at gcc dot gnu dot org
2005-09-07 21:25 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-04 6:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-04 06:29 -------
Patch waiting for some feedback about its interaction with cygwin.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-09-03 08:46:02 |2005-09-04 06:29:00
date| |
Summary|[migwin32] rewind truncates |[mingw32] rewind truncates
|file |file
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [mingw32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-09-04 6:29 ` [Bug libfortran/23262] [mingw32] " fxcoudert at gcc dot gnu dot org
@ 2005-09-07 21:25 ` cvs-commit at gcc dot gnu dot org
2005-09-07 21:32 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-07 21:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-07 21:25 -------
Subject: Bug 23262
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: fxcoudert@gcc.gnu.org 2005-09-07 21:25:40
Modified files:
libgfortran : ChangeLog acinclude.m4 config.h.in configure
configure.ac
libgfortran/io : transfer.c unix.c
Log message:
PR libfortran/23262
* acinclude.m4 (LIBGFOR_CHECK_CRLF): New check.
* configure.ac: Use new check.
* configure.in: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* io/transfer.c (next_record_w): Add case for CRLF as line
terminator.
* io/unix.c (tempfile, regular_file): Open files with
O_BINARY on systems with CRLF.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.296&r2=1.297
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/acinclude.m4.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/config.h.in.diff?cvsroot=gcc&r1=1.24&r2=1.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.diff?cvsroot=gcc&r1=1.42&r2=1.43
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.ac.diff?cvsroot=gcc&r1=1.32&r2=1.33
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&r1=1.56&r2=1.57
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/unix.c.diff?cvsroot=gcc&r1=1.36&r2=1.37
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [mingw32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-09-07 21:25 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-07 21:32 ` cvs-commit at gcc dot gnu dot org
2005-09-07 21:33 ` fxcoudert at gcc dot gnu dot org
2005-09-08 20:50 ` fxcoudert at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-07 21:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-07 21:32 -------
Subject: Bug 23262
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: fxcoudert@gcc.gnu.org 2005-09-07 21:31:57
Modified files:
libgfortran : ChangeLog acinclude.m4 config.h.in configure
configure.ac
libgfortran/io : transfer.c unix.c
Log message:
PR libfortran/23262
* acinclude.m4 (LIBGFOR_CHECK_CRLF): New check.
* configure.ac: Use new check.
* configure.in: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* io/transfer.c (next_record_w): Add case for CRLF as line
terminator.
* io/unix.c (tempfile, regular_file): Open files with
O_BINARY on systems with CRLF.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.88&r2=1.163.2.89
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/acinclude.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/config.h.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.16.12.6&r2=1.16.12.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26.12.8&r2=1.26.12.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.ac.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.20.12.8&r2=1.20.12.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32.2.15&r2=1.32.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/unix.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.21.10.13&r2=1.21.10.14
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [mingw32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-09-07 21:32 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-07 21:33 ` fxcoudert at gcc dot gnu dot org
2005-09-08 20:50 ` fxcoudert at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-07 21:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-07 21:33 -------
Patch commited, bug fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/23262] [mingw32] rewind truncates file
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
` (10 preceding siblings ...)
2005-09-07 21:33 ` fxcoudert at gcc dot gnu dot org
@ 2005-09-08 20:50 ` fxcoudert at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-09-08 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-09-08 20:50 -------
*** Bug 23483 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |dir at lanl dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23262
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-09-08 20:50 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-06 19:46 [Bug libfortran/23262] New: rewind truncates file fxcoudert at gcc dot gnu dot org
2005-08-07 13:05 ` [Bug libfortran/23262] " fxcoudert at gcc dot gnu dot org
2005-08-07 15:17 ` [Bug libfortran/23262] rewind truncates file on migwin32 pinskia at gcc dot gnu dot org
2005-08-07 15:19 ` [Bug libfortran/23262] [migwin32] rewind truncates file pinskia at gcc dot gnu dot org
2005-08-07 15:20 ` pinskia at gcc dot gnu dot org
2005-09-03 8:46 ` fxcoudert at gcc dot gnu dot org
2005-09-03 10:15 ` fxcoudert at gcc dot gnu dot org
2005-09-03 19:09 ` fxcoudert at gcc dot gnu dot org
2005-09-04 6:29 ` [Bug libfortran/23262] [mingw32] " fxcoudert at gcc dot gnu dot org
2005-09-07 21:25 ` cvs-commit at gcc dot gnu dot org
2005-09-07 21:32 ` cvs-commit at gcc dot gnu dot org
2005-09-07 21:33 ` fxcoudert at gcc dot gnu dot org
2005-09-08 20:50 ` fxcoudert 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).