public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/24700] New: Bad write after backing up from end of file
@ 2005-11-06 23:55 jvdelisle at gcc dot gnu dot org
2005-11-06 23:58 ` [Bug libfortran/24700] " jvdelisle at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2005-11-06 23:55 UTC (permalink / raw)
To: gcc-bugs
The following program from http://gcc.gnu.org/ml/fortran/2005-11/msg00084.html
incorrectly writesthe 'TEST' file. Thanks to Georgy Salnikov for finding and
submitting this bug.
PROGRAM TEST
CHARACTER*8 TXT
DATA TXT/'**TEST**'/
OPEN (1, FILE='TEST', STATUS='UNKNOWN', FORM='UNFORMATTED')
WRITE (1) TXT
REWIND 1
READ (1, END=1) TXT
READ (1, END=1) TXT
1 CONTINUE
BACKSPACE 1
WRITE (1) TXT
CLOSE (1, STATUS='KEEP')
END
Georgy also submitted a patch which is considered obvious:
diff -Naur gcc-4.0.2.orig/libgfortran/io/transfer.c
gcc-4.0.2/libgfortran/io/transfer.c
--- gcc-4.0.2.orig/libgfortran/io/transfer.c 2005-09-12 01:55:16.000000000
+0700
+++ gcc-4.0.2/libgfortran/io/transfer.c 2005-10-15 12:29:13.000000000 +0700
@@ -1641,11 +1641,13 @@
{
generate_error (ERROR_END, NULL);
current_unit->endfile = AFTER_ENDFILE;
+ current_unit->current_record = 0;
}
break;
case AFTER_ENDFILE:
generate_error (ERROR_ENDFILE, NULL);
+ current_unit->current_record = 0;
break;
}
}
Test results to follow:
--
Summary: Bad write after backing up from end of file
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: jvdelisle at gcc dot gnu dot org
ReportedBy: jvdelisle at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24700
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libfortran/24700] Bad write after backing up from end of file
2005-11-06 23:55 [Bug libfortran/24700] New: Bad write after backing up from end of file jvdelisle at gcc dot gnu dot org
@ 2005-11-06 23:58 ` jvdelisle at gcc dot gnu dot org
2005-11-11 18:52 ` jvdelisle at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2005-11-06 23:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jvdelisle at gcc dot gnu dot org 2005-11-06 23:58 -------
Testing that patch gives the following results. I will put together a test
case and commit this as obvious unless there are objections.
hex dump of TEST file created using gfortran 4.0.1 gives, with no patch:
$ xxd TEST
0000000: 0800 0000 0000 0000 2a2a 5445 5354 2a2a ........**TEST**
0000010: 0800 0000 0000 0000 0800 0000 0000 0000 ................
0000020: 2a2a 5445 5354 2a2a 0800 0000 0000 0000 **TEST**........
With gfortran 4.1 we get:
$ xxd TEST
0000000: 0800 0000 0000 0000 2a2a 5445 5354 2a2a ........**TEST**
0000010: 0800 0000 0000 0000 2a2a 5445 5354 2a2a ........**TEST**
0000020: ffff ffff ffff ff7f ........
With Georgy's patch on 4.0.3:
$ xxd TEST
0000000: 0800 0000 0000 0000 2a2a 5445 5354 2a2a ........**TEST**
0000010: 0800 0000 0000 0000 0800 0000 0000 0000 ................
0000020: 2a2a 5445 5354 2a2a 0800 0000 0000 0000 **TEST**........
With Georgy's patch on 4.1:
$ xxd TEST
0000000: 0800 0000 0000 0000 2a2a 5445 5354 2a2a ........**TEST**
0000010: 0800 0000 0000 0000 0800 0000 0000 0000 ................
0000020: 2a2a 5445 5354 2a2a 0800 0000 0000 0000 **TEST**........
So it appears we had a regression from 4.0.1 in there somehow and did not catch
it.
Regards
Jerry
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-11-06 23:58:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24700
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libfortran/24700] Bad write after backing up from end of file
2005-11-06 23:55 [Bug libfortran/24700] New: Bad write after backing up from end of file jvdelisle at gcc dot gnu dot org
2005-11-06 23:58 ` [Bug libfortran/24700] " jvdelisle at gcc dot gnu dot org
@ 2005-11-11 18:52 ` jvdelisle at gcc dot gnu dot org
2005-11-12 23:13 ` jvdelisle at gcc dot gnu dot org
2005-11-13 6:32 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2005-11-11 18:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jvdelisle at gcc dot gnu dot org 2005-11-11 18:52 -------
*** Bug 24796 has been marked as a duplicate of this bug. ***
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chjacob at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24700
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libfortran/24700] Bad write after backing up from end of file
2005-11-06 23:55 [Bug libfortran/24700] New: Bad write after backing up from end of file jvdelisle at gcc dot gnu dot org
2005-11-06 23:58 ` [Bug libfortran/24700] " jvdelisle at gcc dot gnu dot org
2005-11-11 18:52 ` jvdelisle at gcc dot gnu dot org
@ 2005-11-12 23:13 ` jvdelisle at gcc dot gnu dot org
2005-11-13 6:32 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2005-11-12 23:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2005-11-12 23:13 -------
Fixed in 4.0.3 and 4.1.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24700
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libfortran/24700] Bad write after backing up from end of file
2005-11-06 23:55 [Bug libfortran/24700] New: Bad write after backing up from end of file jvdelisle at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-11-12 23:13 ` jvdelisle at gcc dot gnu dot org
@ 2005-11-13 6:32 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-13 6:32 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24700
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-11-13 6:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-06 23:55 [Bug libfortran/24700] New: Bad write after backing up from end of file jvdelisle at gcc dot gnu dot org
2005-11-06 23:58 ` [Bug libfortran/24700] " jvdelisle at gcc dot gnu dot org
2005-11-11 18:52 ` jvdelisle at gcc dot gnu dot org
2005-11-12 23:13 ` jvdelisle at gcc dot gnu dot org
2005-11-13 6:32 ` 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).