This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g77-alpha binary file BACKSPACE does not work
- To: Gabor Magyarfalvi <gmagyarf at uafchempc1 dot uark dot edu>
- Subject: Re: g77-alpha binary file BACKSPACE does not work
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Thu, 15 Jan 98 22:09:48 +0100
- Cc: egcs-bugs at cygnus dot com
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <199801151709.LAA21819@uafchempc1.uark.edu>
[ doesn't fail on my m68k-next-nextstep3 too ]
> program test1
> real*8 a,b
> dimension a(100), b(100)
> open(unit=21,file='test.21',form='unformatted')
> do i=1,100
> a(i)=i
> end do
> write(21) a
> do i=1,100
> a(i)=a(i)+i
> end do
> write(21) a
> backspace 21
> read(21) b
> print *, b(1), b(10), b(50), b(90), b(100)
> end
> This program runs fine on intel-egcs--g77,but on an alpha
> do_us: end of file apparent state: unit 21 named test.21
> lately reading sequential unformatted external IO Aborted
> (core dumped)
> is the result. Is this a bug in the compiler, the f2c
> lib or our humble code.
During "backspace", the following code is executed (see
egcs-1.0.1/gcc/f/runtime/libI77):
f_back (a=0x12010fcc8) at backspace.c:36
36 if(b->url>0)
(gdb)
47 if(b->ufmt==0)
(gdb)
48 { (void) fseek(b->ufd,-(long)sizeof(int),SEEK_CUR);
(gdb)
49 (void) fread((char *)&n,sizeof(int),1,b->ufd);
(gdb)
50 (void)
fseek(b->ufd,-(long)n-2*sizeof(int),SEEK_CUR);
(gdb) p n
$19 = 0
Note that n == 0, and therefore the "seek back" isn't effective.
Could someone with more experience on Linux/Alpha join in to tell us
the exact argument signature of fseek, as I suspect that the cast
to long (64-bits on Alpha) might be wrong ...
HTH,
Toon.