public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/19568] New: incorrect formatted read
@ 2005-01-21 17:46 gay at sfu dot ca
2005-01-22 4:16 ` [Bug libfortran/19568] " bdavis at gcc dot gnu dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: gay at sfu dot ca @ 2005-01-21 17:46 UTC (permalink / raw)
To: gcc-bugs
gfortran formatted read incorrectly reads beyond end of record when
record length is < io,format length.
Demo:
ian@ian:~/source/test> cat ftest.f95
program ftest
integer i
character*1 b(10)
open (77, file='input_file')
read (77, '(10A1)') b
print *, b
end program ftest
ian@ian:~/source/test> cat input_file
Line 1
Line 2
Line 3
Line 4
ian@ian:~/source/test> gfortran -v
Using built-in specs.
Configured with: ../gcc/configure --enable-languages=c,f95
--prefix=/usr/work/2005020/irun
Thread model: posix
gcc version 4.0.0 20050120 (experimental)
ian@ian:~/source/test> gfortran -o ftest ftest.f95
ian@ian:~/source/test> ./ftest
Line 1 Lin
--
Summary: incorrect formatted read
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gay at sfu dot ca
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
@ 2005-01-22 4:16 ` bdavis at gcc dot gnu dot org
2005-01-31 17:03 ` Thomas dot Koenig at online dot de
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2005-01-22 4:16 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|fortran |libfortran
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-01-22 04:16:07
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
2005-01-22 4:16 ` [Bug libfortran/19568] " bdavis at gcc dot gnu dot org
@ 2005-01-31 17:03 ` Thomas dot Koenig at online dot de
2005-02-01 13:08 ` Thomas dot Koenig at online dot de
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-01-31 17:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-01-31 17:02 -------
This looks promising.
I'll do a full check later.
Thomas
--- transfer.c.orig 2005-01-31 18:03:12.000000000 +0100
+++ transfer.c 2005-01-31 18:04:00.000000000 +0100
@@ -150,6 +150,14 @@
else
p = base = data;
+ /* If we have seen the end of the record already, we just
+ * return blanks.
+ */
+ if (sf_seen_eor) {
+ memset(base,' ',*length);
+ return base;
+ }
+
memset(base,'\0',*length);
current_unit->bytes_left = options.default_recl;
@@ -1222,8 +1230,11 @@
case FORMATTED_SEQUENTIAL:
length = 1;
/* sf_read has already terminated input because of an '\n' */
- if (sf_seen_eor)
- break;
+ if (sf_seen_eor)
+ {
+ sf_seen_eor = 0;
+ break;
+ }
do
{
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
2005-01-22 4:16 ` [Bug libfortran/19568] " bdavis at gcc dot gnu dot org
2005-01-31 17:03 ` Thomas dot Koenig at online dot de
@ 2005-02-01 13:08 ` Thomas dot Koenig at online dot de
2005-02-01 16:41 ` Thomas dot Koenig at online dot de
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-02-01 13:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-02-01 13:08 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02295.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (2 preceding siblings ...)
2005-02-01 13:08 ` Thomas dot Koenig at online dot de
@ 2005-02-01 16:41 ` Thomas dot Koenig at online dot de
2005-02-01 20:01 ` Thomas dot Koenig at online dot de
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-02-01 16:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-02-01 16:41 -------
The patch does not handle advance="NO" correctly.
I'll need to do something else.
Thomas
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (3 preceding siblings ...)
2005-02-01 16:41 ` Thomas dot Koenig at online dot de
@ 2005-02-01 20:01 ` Thomas dot Koenig at online dot de
2005-03-06 23:34 ` Thomas dot Koenig at online dot de
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-02-01 20:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-02-01 20:01 -------
Replying to myself here...
After having thought of this, I think the patch should go in
because it fixes a g77 regression, and advance= isn't among the
things that g77 supports.
Thomas
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (4 preceding siblings ...)
2005-02-01 20:01 ` Thomas dot Koenig at online dot de
@ 2005-03-06 23:34 ` Thomas dot Koenig at online dot de
2005-03-08 8:21 ` Thomas dot Koenig at online dot de
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-03-06 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-03-06 23:34 -------
Updated patch:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00566.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (5 preceding siblings ...)
2005-03-06 23:34 ` Thomas dot Koenig at online dot de
@ 2005-03-08 8:21 ` Thomas dot Koenig at online dot de
2005-04-10 8:36 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-03-08 8:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Thomas dot Koenig at online dot de 2005-03-08 08:21 -------
Updated patch:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00729.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (6 preceding siblings ...)
2005-03-08 8:21 ` Thomas dot Koenig at online dot de
@ 2005-04-10 8:36 ` cvs-commit at gcc dot gnu dot org
2005-04-10 8:38 ` tkoenig at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-10 8:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-10 08:36 -------
Subject: Bug 19568
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: tkoenig@gcc.gnu.org 2005-04-10 08:35:40
Modified files:
libgfortran : ChangeLog
libgfortran/io : transfer.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.dg: eor_handling_1.f90 eor_handling_2.f90
eor_handling_3.f90 eor_handling_4.f90
eor_handling_5.f90 noadv_size.f90
pad_no.f90
Log message:
2005-04-10 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/17992
PR libfortran/19568
PR libfortran/19595
PR libfortran/20005
PR libfortran/20092
PR libfortran/20131
PR libfortran/20138
PR libfortran/20661
PR libfortran/20744
* io/transfer.c (top level): eor_condition: New static variable.
(read_sf): Remove unnecessary zeroing of buffer (there is enough
information in its length).
Return a string of length 0 (to be padded by caller) if EOR was
seen previously.
Remove erroneous special casing of EOR for standard input.
Set eor_condition for non-advancing I/O if an end of line was
detected.
Increment ioparm.size if necessary.
(formatted_transfer): Skip the function if there is an EOR condition.
(data_transfer_init): Initialize eor_condition to zero (false).
(next_record_r): Clear sf_seen_eor if a \n has been seen already.
(finalize_transfer): If there is an EOR condition, raise the error.
2005-04-10 Thomas Koenig <Thomas.Koenig@online.de>
* eor_handling_1.f90: New test case.
* eor_handling_2.f90: New test case.
* eor_handling_3.f90: New test case.
* eor_handling_4.f90: New test case.
* eor_handling_5.f90: New test case.
* noadv_size.f90: New test case.
* pad_no.f90: New test case.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.188&r2=1.189
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/transfer.c.diff?cvsroot=gcc&r1=1.35&r2=1.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5320&r2=1.5321
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_3.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_4.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_5.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/noadv_size.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pad_no.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (7 preceding siblings ...)
2005-04-10 8:36 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-10 8:38 ` tkoenig at gcc dot gnu dot org
2005-05-03 19:41 ` [Bug libfortran/19568] [4.0 only] " cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-10 8:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tkoenig at gcc dot gnu dot org 2005-04-10 08:38 -------
Fixed in 4.1.0, waiting for 4.0 to reopen.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] [4.0 only] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (8 preceding siblings ...)
2005-04-10 8:38 ` tkoenig at gcc dot gnu dot org
@ 2005-05-03 19:41 ` cvs-commit at gcc dot gnu dot org
2005-05-03 19:51 ` tkoenig at gcc dot gnu dot org
2005-06-05 7:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-03 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-03 19:40 -------
Subject: Bug 19568
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: tkoenig@gcc.gnu.org 2005-05-03 19:39:36
Modified files:
libgfortran : ChangeLog
libgfortran/io : transfer.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gfortran.dg: eor_handling_1.f90 eor_handling_2.f90
eor_handling_3.f90 eor_handling_4.f90
eor_handling_5.f90 noadv_size.f90
pad_no.f90
Log message:
2005-05-03 Thomas Koenig <Thomas.Koenig@online.de>
Backport from mainline:
PR libfortran/17992
PR libfortran/19568
PR libfortran/19595
PR libfortran/20005
PR libfortran/20092
PR libfortran/20131
PR libfortran/20661
PR libfortran/20744
* io/transfer.c (top level): eor_condition: New static variable.
(read_sf): Remove unnecessary zeroing of buffer (there is enough
information in its length).
Return a string of length 0 (to be padded by caller) if EOR was
seen previously.
Remove erroneous special casing of EOR for standard input.
Set eor_condition for non-advancing I/O if an end of line was
detected.
Increment ioparm.size if necessary.
(formatted_transfer): Skip the function if there is an EOR condition.
(data_transfer_init): Initialize eor_condition to zero (false).
(next_record_r): Clear sf_seen_eor if a \n has been seen already.
(finalize_transfer): If there is an EOR condition, raise the error.
2005-05-03 Thomas Koenig <Thomas.Koenig@online.de>
Backport from mainline:
* eor_handling_1.f90: New test case.
* eor_handling_2.f90: New test case.
* eor_handling_3.f90: New test case.
* eor_handling_4.f90: New test case.
* eor_handling_5.f90: New test case.
* noadv_size.f90: New test case.
* pad_no.f90: New test case.
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.22&r2=1.163.2.23
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.2&r2=1.32.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.156&r2=1.5084.2.157
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_2.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_3.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_4.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/eor_handling_5.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/noadv_size.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/pad_no.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.6.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] [4.0 only] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (9 preceding siblings ...)
2005-05-03 19:41 ` [Bug libfortran/19568] [4.0 only] " cvs-commit at gcc dot gnu dot org
@ 2005-05-03 19:51 ` tkoenig at gcc dot gnu dot org
2005-06-05 7:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-05-03 19:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tkoenig at gcc dot gnu dot org 2005-05-03 19:51 -------
Patch committed to 4.0.1. Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/19568] [4.0 only] incorrect formatted read
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
` (10 preceding siblings ...)
2005-05-03 19:51 ` tkoenig at gcc dot gnu dot org
@ 2005-06-05 7:45 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 7:45 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19568
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-06-05 7:45 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 17:46 [Bug fortran/19568] New: incorrect formatted read gay at sfu dot ca
2005-01-22 4:16 ` [Bug libfortran/19568] " bdavis at gcc dot gnu dot org
2005-01-31 17:03 ` Thomas dot Koenig at online dot de
2005-02-01 13:08 ` Thomas dot Koenig at online dot de
2005-02-01 16:41 ` Thomas dot Koenig at online dot de
2005-02-01 20:01 ` Thomas dot Koenig at online dot de
2005-03-06 23:34 ` Thomas dot Koenig at online dot de
2005-03-08 8:21 ` Thomas dot Koenig at online dot de
2005-04-10 8:36 ` cvs-commit at gcc dot gnu dot org
2005-04-10 8:38 ` tkoenig at gcc dot gnu dot org
2005-05-03 19:41 ` [Bug libfortran/19568] [4.0 only] " cvs-commit at gcc dot gnu dot org
2005-05-03 19:51 ` tkoenig at gcc dot gnu dot org
2005-06-05 7:45 ` pinskia 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).