* Interesting Fortran Behaviour
@ 1994-02-24 12:16 Wesp Gerhard
1994-02-24 17:38 ` Jim Brown
1994-02-25 10:49 ` Michael Lemke
0 siblings, 2 replies; 3+ messages in thread
From: Wesp Gerhard @ 1994-02-24 12:16 UTC (permalink / raw)
Consider the following little C and Fortran programs:
--- 4711.c -------------------------
#include <stdio.h>
void main()
{
int i;
for(i= 1; i <= 4000; i++)
printf("4711.47114711\n");
}
------------------------------------
This just prints the number 4711.47114711 to stdout 4000 times and then
terminates.
--- crunch.f -----------------------
program crunch
integer i
double precision a
do 4711 i= 1, 4000
read *, a
4711 continue
print *, 'read 4000 numbers'
end
------------------------------------
This trys to read 4000 numbers from stdin, and, if successfully, prints
the message 'read 4000 numbers' to stdout and terminates.
So what would you expect if you connect those two programs by a pipe, e.g.
"4711 | crunch"? Well, 4711 should produce 4000 numbers, crunch should con-
sume them and happily terminate with 'read 4000 numbers'.
And that's exactly what it does on a good old Tektronix m88k workstation.
However, on our new ALPHA workstations with DEC OSF1 V1.3, DEC Fortran
and the DEC C-compiler, the following happens (shell is csh):
% l
total 4
drwxr-xr-x 2 wesp rist 512 Feb 24 11:34 ./
drwxr-xr-x 7 wesp rist 512 Feb 23 14:42 ../
-rw-r--r-- 1 wesp rist 108 Feb 24 10:14 4711.c
-rw-r--r-- 1 wesp rist 181 Feb 24 10:24 crunch.f
% make 4711 crunch
cc -O 4711.c -o 4711
f77 -O crunch.f -o crunch
% while(1)
? 4711 | crunch
? end
read 4000 numbers
read 4000 numbers
forrtl: severe: input record too long, unit 5, file stdin
read 4000 numbers
read 4000 numbers
read 4000 numbers
read 4000 numbers
forrtl: severe: input record too long, unit 5, file stdin
[...]
forrtl: severe: input record too long, unit 5, file stdin
read 4000 numbers
read 4000 numbers
read 4000 numbers
forrtl: severe: input record too long, unit 5, file stdin
read 4000 numbers
read 4000 numbers
forrtl: severe: input record too long, unit 5, file stdin
[...]
It seems that every fifth time or so "crunch" terminates with the error
message "forrtl: severe: input record too long, unit 5, file stdin".
On our DECstations under Ultrix it's even worse:
% while(1)
? 4711 | crunch
? end
forrtl: severe: input record too long, unit 5, file stdin
forrtl: severe: input record too long, unit 5, file stdin
forrtl: severe: input record too long, unit 5, file stdin
forrtl: severe: input record too long, unit 5, file stdin
[...]
However, if I pipe the 4711 output into a file ("4711 > tmpfile"),
"crunch < tmpfile" always works correctly!
What am I missing?
Greetings,
-Gerhard
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Interesting Fortran Behaviour
1994-02-24 12:16 Interesting Fortran Behaviour Wesp Gerhard
@ 1994-02-24 17:38 ` Jim Brown
1994-02-25 10:49 ` Michael Lemke
1 sibling, 0 replies; 3+ messages in thread
From: Jim Brown @ 1994-02-24 17:38 UTC (permalink / raw)
This test case works fine on OSF T2.0-3 with FORTRAN T3.4 and FORTRAN RTL 339.
--
Jim Brown, University of Miami, RSMAS/MPO
[send mail to jim@lime.rsmas.miami.edu]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Interesting Fortran Behaviour
1994-02-24 12:16 Interesting Fortran Behaviour Wesp Gerhard
1994-02-24 17:38 ` Jim Brown
@ 1994-02-25 10:49 ` Michael Lemke
1 sibling, 0 replies; 3+ messages in thread
From: Michael Lemke @ 1994-02-25 10:49 UTC (permalink / raw)
In article <CLqA3L.Lxv@wst.edvz.sbg.ac.at>,
Wesp Gerhard <gwesp@wst.edvz.sbg.ac.at> wrote:
> Consider the following little C and Fortran programs:
>--- 4711.c -------------------------
>#include <stdio.h>
>
>void main()
>{
> int i;
> for(i= 1; i <= 4000; i++)
> printf("4711.47114711\n");
>}
>------------------------------------
>This just prints the number 4711.47114711 to stdout 4000 times and then
>terminates.
>
>--- crunch.f -----------------------
> program crunch
>
> integer i
> double precision a
>
> do 4711 i= 1, 4000
> read *, a
>4711 continue
>
> print *, 'read 4000 numbers'
>
> end
>------------------------------------
>This trys to read 4000 numbers from stdin, and, if successfully, prints
>the message 'read 4000 numbers' to stdout and terminates.
>
> So what would you expect if you connect those two programs by a pipe, e.g.
>"4711 | crunch"? Well, 4711 should produce 4000 numbers, crunch should con-
>sume them and happily terminate with 'read 4000 numbers'.
> And that's exactly what it does on a good old Tektronix m88k workstation.
>
And that's exactly what it does on a Sun workstation.
Michael
--
Michael Lemke
Institute of Astronomy, Cambridge UK
(michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1994-02-25 10:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-02-24 12:16 Interesting Fortran Behaviour Wesp Gerhard
1994-02-24 17:38 ` Jim Brown
1994-02-25 10:49 ` Michael Lemke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox