From: gwesp@wst.edvz.sbg.ac.at (Wesp Gerhard)
Subject: Interesting Fortran Behaviour
Date: Thu, 24 Feb 1994 12:16:32 GMT [thread overview]
Message-ID: <CLqA3L.Lxv@wst.edvz.sbg.ac.at> (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
next reply other threads:[~1994-02-24 12:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-02-24 12:16 Wesp Gerhard [this message]
1994-02-24 17:38 ` Interesting Fortran Behaviour Jim Brown
1994-02-25 10:49 ` Michael Lemke
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox