public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
@ 2006-09-28 22:39 tobias dot burnus at physik dot fu-berlin dot de
2006-09-28 23:23 ` [Bug fortran/29277] " jvdelisle at gcc dot gnu dot org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-09-28 22:39 UTC (permalink / raw)
To: gcc-bugs
See http://gcc.gnu.org/ml/fortran/2006-09/msg00415.html
Brooks Moses wrote:
when a file is connected for stream access, the runtime library could very
easily do a s/\n/\r\n/ on the output stream before writing it to the file. In
fact, if we consider \r\n to be a record marker (on a given system), and we do
wish to implement the behavior described in this paragraph [10.6.3] then it
would be required to do so.
Actually, now that I read section 9.2.2.3 (and particularly note 9.9) on the
Fortran 2003 Standard, I'm pretty sure it was the intent of the standard
committee that this sort of substitution be done. Note 9.9 states:
There may be some character positions in the file that do not correspond
to characters written; this is because on some processors a record
marker may be written to the file as a carriage-return/linefeed
or other sequence. The means of determining the position in a file
connected for stream access is via the POS= specifier in an INQUIRE
statement (9.9.1.21).
Note, in particular, that this whole matter only applies to _formatted_ stream
files -- that is, files which are expected to contain human-readable text that
could be edited in a text editor. For unformatted stream files -- which are the
only ones that should be containing "binary" data that would be corrupted by
the substitution -- this doesn't apply, and no substitution would be made.
Thus, I think it's pretty clear that NEW_LINE should return ACHAR(10), and that
for formatted stream-access files, the runtime library should convert that
character to the appropriate system-specific line-ending string when writing to
files. (This substitution would not be a regression against g77, because files
opened for stream access do not exist in g77 code, and the substitution would
not be made for non-stream files.)
--
Summary: Formated stream output: Translate "\n" / achar(10) into
"\r\n" on some platforms
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot burnus at physik dot fu-berlin dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
@ 2006-09-28 23:23 ` jvdelisle at gcc dot gnu dot org
2006-09-28 23:37 ` jvdelisle at gcc dot gnu dot org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-28 23:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jvdelisle at gcc dot gnu dot org 2006-09-28 23:23 -------
Please note that with formatted stream I/O we implicitly write a /n or /r/n in
the next_record_w () function in transfer.c depending on the system. I think
this meets the intent.
Now an issue I see is what if we want to explicitly write a /n on this system?
There would be no way to do that if we translate it to /n/r. I am not sure the
intent of the committee was to restrict this in this way, but allow it in the
case of formatted end of record.
I have not tried this, but if I write out a formatted string with one character
/n I wonder if we we get /n/r/n with current gfortran.
I am not agreeing or diagreeing here. You have raised a good question here.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
2006-09-28 23:23 ` [Bug fortran/29277] " jvdelisle at gcc dot gnu dot org
@ 2006-09-28 23:37 ` jvdelisle at gcc dot gnu dot org
2006-10-04 5:28 ` jvdelisle at gcc dot gnu dot org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-28 23:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jvdelisle at gcc dot gnu dot org 2006-09-28 23:36 -------
Another thought occurs to me. With formatted stream I/O the newline is handled
automatically for the user. However, there is nothing to say someone would not
want to use unformatted stream I/O to write human readable files. In that
case, you would want the result of newline to give the /r/n or /n on the
respective systems.
Based on this thinking, the translation, if any, should be done for unformatted
I/O and only when the NEWLINE function is explicitly used.
Clealy we have a case where the standard may not be all that clear.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
2006-09-28 23:23 ` [Bug fortran/29277] " jvdelisle at gcc dot gnu dot org
2006-09-28 23:37 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-04 5:28 ` jvdelisle at gcc dot gnu dot org
2006-10-04 6:28 ` jvdelisle at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-04 5:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2006-10-04 05:28 -------
OK, I confess I sen a note to Richard Maine to doble check on this. Brooks has
it absolutely right. So, I will see what I can come up with for you. If its a
requirement of the standard, it is not an enhancement.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jvdelisle at gcc dot gnu dot
|dot org |org
Severity|enhancement |normal
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-10-04 05:28:37
date| |
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (2 preceding siblings ...)
2006-10-04 5:28 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-04 6:28 ` jvdelisle at gcc dot gnu dot org
2006-10-09 3:07 ` jvdelisle at gcc dot gnu dot org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-04 6:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2006-10-04 06:28 -------
Oops. This is F2003 issue and therfore an enhancement relative to F95.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (3 preceding siblings ...)
2006-10-04 6:28 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-09 3:07 ` jvdelisle at gcc dot gnu dot org
2006-10-09 3:39 ` jvdelisle at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-09 3:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jvdelisle at gcc dot gnu dot org 2006-10-09 03:07 -------
Created an attachment (id=12398)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12398&action=view)
Preliminaey patch for STREAM formatted read.
There is a related problem with formatted stream read:
program stream
implicit none
character(len=50) :: r1,r2
open(10,file='test.dat',form='formatted',access='stream',status='old')
read(10,'(a)') r1
read(10,'(a)') r2
print *, ':',trim(r1),':'
print *, ':',trim(r2),':'
end program stream
I have a preliminary patch for this that I would appreciate some testing on
cygwin or other CR-LF type system. This is for the read only.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (4 preceding siblings ...)
2006-10-09 3:07 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-09 3:39 ` jvdelisle at gcc dot gnu dot org
2006-10-13 1:30 ` patchapp at dberlin dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-09 3:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2006-10-09 03:38 -------
I expect the test case streamio_4.f90 to fail with the preliminary patch. I
have not completed the formatted stream write portion. What I need confirmed
is that when reading that the file is being positioned correctly when a CR-LF
is encountered.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (5 preceding siblings ...)
2006-10-09 3:39 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-13 1:30 ` patchapp at dberlin dot org
2006-10-13 1:41 ` jvdelisle at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: patchapp at dberlin dot org @ 2006-10-13 1:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from patchapp at dberlin dot org 2006-10-13 01:30 -------
Subject: Bug number PR29277
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00677.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (6 preceding siblings ...)
2006-10-13 1:30 ` patchapp at dberlin dot org
@ 2006-10-13 1:41 ` jvdelisle at gcc dot gnu dot org
2006-10-18 4:04 ` jvdelisle at gcc dot gnu dot org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-13 1:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jvdelisle at gcc dot gnu dot org 2006-10-13 01:41 -------
Note: I believe it may be necessary to explicitly inject a '\r' when a '\n' is
embedded in a string. I am not quite set up to test this yet here. So I would
much appreciate if some one can do that, while I continue to study that part.
The patch submitted in comment #7 is fully test on '\n' only system.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (7 preceding siblings ...)
2006-10-13 1:41 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-18 4:04 ` jvdelisle at gcc dot gnu dot org
2006-10-18 4:08 ` jvdelisle at gcc dot gnu dot org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-18 4:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jvdelisle at gcc dot gnu dot org 2006-10-18 04:04 -------
Subject: Bug 29277
Author: jvdelisle
Date: Wed Oct 18 04:04:07 2006
New Revision: 117846
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117846
Log:
2006-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/29277
* io/list_read.c (next_char): Update strm_pos.
(eat_separator): Delete extra call to unget_char.
* io/transfer.c (read_block): Use read_sf for formatted stream I/O.
(next_record_r): Update strm_pos for formatted stream I/O and handle
end-of-record correctly.
(next_record_w): Ditto.
(next_record): Enable next record (r/w) functions and update strm_pos.
(finalize_transfer): Call next_record to finish the record.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/list_read.c
trunk/libgfortran/io/transfer.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (8 preceding siblings ...)
2006-10-18 4:04 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-18 4:08 ` jvdelisle at gcc dot gnu dot org
2006-10-18 6:03 ` jvdelisle at gcc dot gnu dot org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-18 4:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jvdelisle at gcc dot gnu dot org 2006-10-18 04:08 -------
Subject: Bug 29277
Author: jvdelisle
Date: Wed Oct 18 04:08:30 2006
New Revision: 117847
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117847
Log:
2006-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/29277
* gfortran.dg/streamio_4.f90: Update test.
* gfortran.dg/streamio_11.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/streamio_11.f90
Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/streamio_4.f90
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (9 preceding siblings ...)
2006-10-18 4:08 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-18 6:03 ` jvdelisle at gcc dot gnu dot org
2006-10-18 7:01 ` patchapp at dberlin dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-18 6:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jvdelisle at gcc dot gnu dot org 2006-10-18 06:03 -------
There is one final patch to go before closing this PR. I am testing it now and
developing a test case. This is the part that converts LF to CR-LF for
FORMATTED STREAM IO on those systems that #define HAVE_CRLF.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (10 preceding siblings ...)
2006-10-18 6:03 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-18 7:01 ` patchapp at dberlin dot org
2006-10-18 23:13 ` jvdelisle at gcc dot gnu dot org
2006-10-18 23:24 ` jvdelisle at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: patchapp at dberlin dot org @ 2006-10-18 7:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from patchapp at dberlin dot org 2006-10-18 07:01 -------
Subject: Bug number PR29277
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00887.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (11 preceding siblings ...)
2006-10-18 7:01 ` patchapp at dberlin dot org
@ 2006-10-18 23:13 ` jvdelisle at gcc dot gnu dot org
2006-10-18 23:24 ` jvdelisle at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-18 23:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jvdelisle at gcc dot gnu dot org 2006-10-18 23:13 -------
Subject: Bug 29277
Author: jvdelisle
Date: Wed Oct 18 23:13:33 2006
New Revision: 117866
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117866
Log:
2006-10-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/29277
* io/write.c (write_a): Add conversion of LF to CR-LF for systems with
#define HAVE_CRLF.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/io/write.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug fortran/29277] Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
` (12 preceding siblings ...)
2006-10-18 23:13 ` jvdelisle at gcc dot gnu dot org
@ 2006-10-18 23:24 ` jvdelisle at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-10-18 23:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from jvdelisle at gcc dot gnu dot org 2006-10-18 23:23 -------
Fixed on 4.2.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29277
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2006-10-18 23:24 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-28 22:39 [Bug fortran/29277] New: Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms tobias dot burnus at physik dot fu-berlin dot de
2006-09-28 23:23 ` [Bug fortran/29277] " jvdelisle at gcc dot gnu dot org
2006-09-28 23:37 ` jvdelisle at gcc dot gnu dot org
2006-10-04 5:28 ` jvdelisle at gcc dot gnu dot org
2006-10-04 6:28 ` jvdelisle at gcc dot gnu dot org
2006-10-09 3:07 ` jvdelisle at gcc dot gnu dot org
2006-10-09 3:39 ` jvdelisle at gcc dot gnu dot org
2006-10-13 1:30 ` patchapp at dberlin dot org
2006-10-13 1:41 ` jvdelisle at gcc dot gnu dot org
2006-10-18 4:04 ` jvdelisle at gcc dot gnu dot org
2006-10-18 4:08 ` jvdelisle at gcc dot gnu dot org
2006-10-18 6:03 ` jvdelisle at gcc dot gnu dot org
2006-10-18 7:01 ` patchapp at dberlin dot org
2006-10-18 23:13 ` jvdelisle at gcc dot gnu dot org
2006-10-18 23:24 ` jvdelisle 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).