Bug 20125

Summary: gfortran - backspace on binary files errors
Product: gcc Reporter: Dale Ranta <dir>
Component: libfortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: fxcoudert, gcc-bugs, pinskia
Priority: P2    
Version: 4.0.0   
Target Milestone: 4.0.0   
Host: powerpc-apple-darwin7.8.0 Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-02-21 19:36:16
Bug Depends on:    
Bug Blocks: 19292    

Description Dale Ranta 2005-02-21 19:30:17 UTC
I don't know if backspace ever works, but while trying to run some calculations
the read after a backspace got some run time errors, crashed, and sometimes hung
the program -

[dir:~/tests/gfortran] dir% gfortran -o backspace backspace.f
[dir:~/tests/gfortran] dir% backspace
At line 5 of file backspace.f
Fortran runtime error: End of file
[dir:~/tests/gfortran] dir% cat backspace.f
      program main
      i=1
      write(3)i
      backspace 3
      read(3)i
      stop
      end
Comment 1 Andrew Pinski 2005-02-21 19:36:16 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-02-21 19:49:52 UTC
Note backspace does work in some testcases but how many and what the situation I don't know right.
Comment 3 GCC Commits 2005-04-03 08:04:22 UTC
Subject: Bug 20125

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	fxcoudert@gcc.gnu.org	2005-04-03 08:04:04

Modified files:
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/io : backspace.c 
Added files:
	gcc/testsuite/gfortran.dg: backspace.f 

Log message:
	PR libfortran/20068
	PR libfortran/20125
	PR libfortran/20156
	PR libfortran/20471
	
	* io/backspace.c (unformatted_backspace): Fix error in arithmetic.
	(st_backspace): When in WRITING mode, we flush and falling back
	into READING mode. In all cases, correctly position the stream.
	
	* gfortran.dg/backspace.f: New test.

Patches:
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.90&r2=1.5084.2.91
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/backspace.f.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
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.13&r2=1.163.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/backspace.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9&r2=1.9.12.1

Comment 4 GCC Commits 2005-04-03 08:07:56 UTC
Subject: Bug 20125

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	fxcoudert@gcc.gnu.org	2005-04-03 08:07:43

Modified files:
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/io : backspace.c 
Added files:
	gcc/testsuite/gfortran.dg: backspace.f 

Log message:
	PR libfortran/20068
	PR libfortran/20125
	PR libfortran/20156
	PR libfortran/20471
	
	* io/backspace.c (unformatted_backspace): Fix error in arithmetic.
	(st_backspace): When in WRITING mode, we flush and falling back
	into READING mode. In all cases, correctly position the stream.
	
	* gfortran.dg/backspace.f: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5270&r2=1.5271
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/backspace.f.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.180&r2=1.181
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/io/backspace.c.diff?cvsroot=gcc&r1=1.9&r2=1.10

Comment 5 Francois-Xavier Coudert 2005-04-03 08:10:11 UTC
Fixed.