public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Error in egcs FORTRAN I/O?
@ 1998-01-02 11:37 Paul Bunyk
  1998-01-02 12:54 ` Toon Moene
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Bunyk @ 1998-01-02 11:37 UTC (permalink / raw)
  To: egcs

Hi! 

I'm trying to use egcs 1.0 to compile our simulation program (mix of
FORTRAN and C). Everything went really great (and performance jumped
20% up in comparison to Absoft F77) until I run into an I/O error
(reproducible). I'm trying to execute the statement
	READ(10,END=100,FMT='(I4)') NERR1
and it fails (with run-time error) in the middle of the file. 'errno' is
set to 29 (#define ESPIPE          29      /* Illegal seek */) and I
suspect that it happens right on the 4-K block boundary. 

Another interesting observation is that in the following code from
'do_fio' which triggers the error (at line 472), the value of n is
exactly 0 (or my gdb does not show it correctly?).

(gdb) frame 7
#7  0x8069d4a in do_fio (number=0x81600bc, ptr=0x81d4b6c "", len=4)
    at /tmp/egcs-1.0/gcc/f/runtime/libI77/fmt.c:472
472                             errfl(f__elist->cierr,errno,"fmt");
(gdb) list
467                     if(ptr==NULL)
468                             return((*f__doend)());
469                     f__cnt[f__cp]--;
470                     f__workdone=1;
471                     if((n=(*f__doed)(p,ptr,len))>0)
472                             errfl(f__elist->cierr,errno,"fmt");
473                     if(n<0)
474                             err(f__elist->ciend,(EOF),"fmt");
475                     continue;
476             case STACK:
(gdb) p n
$39 = 0
(gdb) p errno
$40 = 29

I'm using 
	egcs-2.90.21 971202 (egcs-1.00 release) 
RedHat 5.0 on an i386 
	Linux version 2.0.32 (root@porky.redhat.com) 
	(gcc version 2.7.2.3) #1 Wed Nov 19 00:46:45 EST 1997)

Any ideas/suggestions what I can try to do next? I have the session
running in background so I can dig deeper if I'd know where to look...

Paul

-- 
  ("`-''-/").___..--''"`-._   UNIX *is* user-friendly, he is just very 
   `6_ 6  )   `-.  (     ).`-.__.`) picky about who his friends are...
   (_Y_.)'  ._   )  `._ `. ``-..-'      Paul Bunyk, Research Scientist
 _..`--'_..-_/  /--'_.' ,'art by           (and part-time UN*X sysadm)
(il),-''  (li),'  ((!.-' F. Lee http://pbunyk.physics.sunysb.edu/~paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
  1998-01-02 11:37 Error in egcs FORTRAN I/O? Paul Bunyk
@ 1998-01-02 12:54 ` Toon Moene
  1998-01-02 14:26   ` Paul Bunyk
  0 siblings, 1 reply; 7+ messages in thread
From: Toon Moene @ 1998-01-02 12:54 UTC (permalink / raw)
  To: Paul Bunyk; +Cc: egcs

Paul,

>  I'm trying to use egcs 1.0 to compile our simulation
>  program (mix of FORTRAN and C). Everything went really
>  great (and performance jumped 20% up in comparison to
>  Absoft F77) until I run into an I/O error (reproducible).
>  I'm trying to execute the statement
>  	READ(10,END=100,FMT='(I4)') NERR1 and it fails
>  (with run-time error) in the middle of the file. 'errno'
>  is set to 29 (#define ESPIPE          29      /* Illegal
>  seek */) and I suspect that it happens right on the 4-K
>  block boundary.

[ On Red Hat 5.0-Intel ]

This suggests that it is a library problem (it could be libf2c.a  
that is at fault, or an underlying library - such as the libc  
library on your OS).  Therefore, the following questions are  
relevant:

    * The libc version on your system (find out by "echo /lib/libc.so.*")

    * The binutils version on your system (find out with "as -v" or  
"ld -v")

    * The version of ldd/ld.so on your system (find out with "ldd -v")

(Copied straight from the pre-release questionnaire ...)

A complete Fortran program showing the problem would be nice too.

Thanks,
Toon.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
  1998-01-02 12:54 ` Toon Moene
@ 1998-01-02 14:26   ` Paul Bunyk
  1998-01-03  3:44     ` Toon Moene
  1998-01-03  5:00     ` Dave Love
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Bunyk @ 1998-01-02 14:26 UTC (permalink / raw)
  To: Toon Moene; +Cc: egcs

Toon Moene writes:
 > Paul,
 > 
 > >  I'm trying to use egcs 1.0 to compile our simulation
 > >  program (mix of FORTRAN and C). Everything went really
 > >  great (and performance jumped 20% up in comparison to
 > >  Absoft F77) until I run into an I/O error (reproducible).
 > >  I'm trying to execute the statement
 > >  	READ(10,END=100,FMT='(I4)') NERR1 and it fails
 > >  (with run-time error) in the middle of the file. 'errno'
 > >  is set to 29 (#define ESPIPE          29      /* Illegal
 > >  seek */) and I suspect that it happens right on the 4-K
 > >  block boundary.
 > 
 > [ On Red Hat 5.0-Intel ]
 > 
 > This suggests that it is a library problem (it could be libf2c.a  
 > that is at fault, or an underlying library - such as the libc  
 > library on your OS).  Therefore, the following questions are  
 > relevant:
 > 
 >     * The libc version on your system (find out by "echo /lib/libc.so.*")

RedHat now packages Linux with new GNU libc, that might be the source
of this problem:
	lib/libc.so.6 -> libc-2.0.5.so

 > 
 >     * The binutils version on your system (find out with "as -v" or  
 > "ld -v")

pbunyk:~> as -v
GNU assembler version 2.8.1 (i686-pc-linux-gnu), using BFD version linux-2.8.1.0.1
pbunyk:~> ld -v
GNU ld version 2.8.1 (with BFD linux-2.8.1.0.1)

 > 
 >     * The version of ldd/ld.so on your system (find out with "ldd -v")

pbunyk:~> ldd --version 
ldd (GNU libc) 2.0.5

 > 
 > (Copied straight from the pre-release questionnaire ...)
 > 
 > A complete Fortran program showing the problem would be nice too.

I would send it, but it is rather large and not that easy to build;
moreover, it takes probably an hour of runtime to get to this
problem. This is why I'm suggesting to look into the details
myself... Or maybe someone have encouuntered a similar problem and
patch already exists...

 > 
 > Thanks,
 > Toon.

Thank you,

Paul

-- 
  ("`-''-/").___..--''"`-._   UNIX *is* user-friendly, he is just very 
   `6_ 6  )   `-.  (     ).`-.__.`) picky about who his friends are...
   (_Y_.)'  ._   )  `._ `. ``-..-'      Paul Bunyk, Research Scientist
 _..`--'_..-_/  /--'_.' ,'art by           (and part-time UN*X sysadm)
(il),-''  (li),'  ((!.-' F. Lee http://pbunyk.physics.sunysb.edu/~paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
  1998-01-02 14:26   ` Paul Bunyk
@ 1998-01-03  3:44     ` Toon Moene
  1998-01-03  5:00     ` Dave Love
  1 sibling, 0 replies; 7+ messages in thread
From: Toon Moene @ 1998-01-03  3:44 UTC (permalink / raw)
  To: Paul Bunyk; +Cc: egcs

I asked:

 > A complete Fortran program showing the problem would be nice too.

And you replied:

>  I would send it, but it is rather large and not that easy
>  to build; moreover, it takes probably an hour of runtime
>  to get to this problem. This is why I'm suggesting to
>  look into the details myself... Or maybe someone have
>  encouuntered a similar problem and patch already exists...

Hmm, yeah, I see - that makes my previous questions also rather  
unhelpfull, as we can't rerun your program that way.

Perhaps some other remarks and questions can help us out:

1. Is the point at which the error is provoked the first
   time through this read statement ?

2. Or is it the first time I/O is done on unit 10 ?

As far as I can see from the libI77 part of the g77 (and f2c)  
runtime library, the function that f__doed points to is probably  
rd_ed (file rdfmt.c), because you're reading a formatted file using  
an `edit string' (I4); it indeed does an fseek (sometimes), and it  
returns errno (why n is still 0 is also not clear to me).

However, I don't see why fseek should fail on unit 10.  Normally,  
unit 10 is either opened by an explicit OPEN statement, or by the  
first I/O on that unit (in which case a file with name `fort.10' is  
opened).  The only way you can get a non-seekable file that way is  
having a named pipe `fort.10' before starting your program.   
However, at open time it is determined whether the file can be  
seeked [sic] (member `useek' of the file unit structure that libI77  
uses internally).  This member is checked before the seek in rd_ed  
is done.

Therefore, I highly suspect one of the underlying components of  
your system (libc or the kernel itself) being at fault here.

I am sorry I cannot help you further.

Toon.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
  1998-01-02 14:26   ` Paul Bunyk
  1998-01-03  3:44     ` Toon Moene
@ 1998-01-03  5:00     ` Dave Love
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Love @ 1998-01-03  5:00 UTC (permalink / raw)
  To: egcs

Since C was mentioned, I'd suspect any attempt to mix C and Fortran
i/o to the same stream, problems with which I've not resolved, but
otherwise this isn't a familiar type of problem.  I'm willing to try
the experiment on a libc5 system if it mainly takes machine time
rather than mine.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
  1999-06-19  6:49 craig
@ 1999-06-30 15:43 ` craig
  0 siblings, 0 replies; 7+ messages in thread
From: craig @ 1999-06-30 15:43 UTC (permalink / raw)
  To: egcs

Just rediscovered this old email.  Is it still pertinent, to egcs 1.1.2,
or the 1.2 (gcc 2.95) version being prepared for release?  If so, do
you have more information, per a more complete bug report?  (If not
still pertinent, feel free to just ignore this email!)

        tq vm, (burley)


>I'm trying to use egcs 1.0 to compile our simulation program (mix of
>FORTRAN and C). Everything went really great (and performance jumped
>20% up in comparison to Absoft F77) until I run into an I/O error
>(reproducible). I'm trying to execute the statement
>	READ(10,END=100,FMT='(I4)') NERR1
>and it fails (with run-time error) in the middle of the file. 'errno' is
>set to 29 (#define ESPIPE          29      /* Illegal seek */) and I
>suspect that it happens right on the 4-K block boundary. 
>
>Another interesting observation is that in the following code from
>'do_fio' which triggers the error (at line 472), the value of n is
>exactly 0 (or my gdb does not show it correctly?).
>
>(gdb) frame 7
>#7  0x8069d4a in do_fio (number=0x81600bc, ptr=0x81d4b6c "", len=4)
>    at /tmp/egcs-1.0/gcc/f/runtime/libI77/fmt.c:472
>472                             errfl(f__elist->cierr,errno,"fmt");
>(gdb) list
>467                     if(ptr==NULL)
>468                             return((*f__doend)());
>469                     f__cnt[f__cp]--;
>470                     f__workdone=1;
>471                     if((n=(*f__doed)(p,ptr,len))>0)
>472                             errfl(f__elist->cierr,errno,"fmt");
>473                     if(n<0)
>474                             err(f__elist->ciend,(EOF),"fmt");
>475                     continue;
>476             case STACK:
>(gdb) p n
>$39 = 0
>(gdb) p errno
>$40 = 29
>
>I'm using 
>	egcs-2.90.21 971202 (egcs-1.00 release) 
>RedHat 5.0 on an i386 
>	Linux version 2.0.32 (root@porky.redhat.com) 
>	(gcc version 2.7.2.3) #1 Wed Nov 19 00:46:45 EST 1997)
>
>Any ideas/suggestions what I can try to do next? I have the session
>running in background so I can dig deeper if I'd know where to look...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error in egcs FORTRAN I/O?
@ 1999-06-19  6:49 craig
  1999-06-30 15:43 ` craig
  0 siblings, 1 reply; 7+ messages in thread
From: craig @ 1999-06-19  6:49 UTC (permalink / raw)
  To: egcs

Just rediscovered this old email.  Is it still pertinent, to egcs 1.1.2,
or the 1.2 (gcc 2.95) version being prepared for release?  If so, do
you have more information, per a more complete bug report?  (If not
still pertinent, feel free to just ignore this email!)

        tq vm, (burley)


>I'm trying to use egcs 1.0 to compile our simulation program (mix of
>FORTRAN and C). Everything went really great (and performance jumped
>20% up in comparison to Absoft F77) until I run into an I/O error
>(reproducible). I'm trying to execute the statement
>	READ(10,END=100,FMT='(I4)') NERR1
>and it fails (with run-time error) in the middle of the file. 'errno' is
>set to 29 (#define ESPIPE          29      /* Illegal seek */) and I
>suspect that it happens right on the 4-K block boundary. 
>
>Another interesting observation is that in the following code from
>'do_fio' which triggers the error (at line 472), the value of n is
>exactly 0 (or my gdb does not show it correctly?).
>
>(gdb) frame 7
>#7  0x8069d4a in do_fio (number=0x81600bc, ptr=0x81d4b6c "", len=4)
>    at /tmp/egcs-1.0/gcc/f/runtime/libI77/fmt.c:472
>472                             errfl(f__elist->cierr,errno,"fmt");
>(gdb) list
>467                     if(ptr==NULL)
>468                             return((*f__doend)());
>469                     f__cnt[f__cp]--;
>470                     f__workdone=1;
>471                     if((n=(*f__doed)(p,ptr,len))>0)
>472                             errfl(f__elist->cierr,errno,"fmt");
>473                     if(n<0)
>474                             err(f__elist->ciend,(EOF),"fmt");
>475                     continue;
>476             case STACK:
>(gdb) p n
>$39 = 0
>(gdb) p errno
>$40 = 29
>
>I'm using 
>	egcs-2.90.21 971202 (egcs-1.00 release) 
>RedHat 5.0 on an i386 
>	Linux version 2.0.32 (root@porky.redhat.com) 
>	(gcc version 2.7.2.3) #1 Wed Nov 19 00:46:45 EST 1997)
>
>Any ideas/suggestions what I can try to do next? I have the session
>running in background so I can dig deeper if I'd know where to look...

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-06-30 15:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-02 11:37 Error in egcs FORTRAN I/O? Paul Bunyk
1998-01-02 12:54 ` Toon Moene
1998-01-02 14:26   ` Paul Bunyk
1998-01-03  3:44     ` Toon Moene
1998-01-03  5:00     ` Dave Love
1999-06-19  6:49 craig
1999-06-30 15:43 ` craig

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).