g77 bug, maybe.

milgram@eng.umd.edu milgram@eng.umd.edu
Mon Oct 19 17:30:00 GMT 1998


see the README

- J.

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-10-19 19:01 EDT by <milgram@tcraft>.
# Source directory was `/var/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    288 -rw-r--r-- demo/Makefile
#    388 -rw-r--r-- demo/demo.f
#   1350 -rw-r--r-- demo/README
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  echo 'WARNING: not restoring timestamps.  Consider getting and'
  echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
# ============= demo/Makefile ==============
if test ! -d 'demo'; then
  echo 'x - creating directory demo'
  mkdir 'demo'
fi
if test -f 'demo/Makefile' && test X"$1" != X"-c"; then
  echo 'x - skipping demo/Makefile (file already exists)'
else
  echo 'x - extracting demo/Makefile (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'demo/Makefile' &&
X
check: demo demo-f2c
X	@echo Running g77 version:
X	-./demo
X	@echo Running f2c version:
X	-./demo-f2c
X	@echo Running ftnchek
X	ftnchek demo.f
X
all: demo demo-f2c
X
demo: demo.f
X	g77 -o $@ $<
demo-f2c: demo.f
X	f2c demo.f
X	gcc -o $@ demo.c -lf2c -lm
clean:
X	$(RM) demo demo-f2c *~ \#* *.o *.c
X
SHAR_EOF
  $shar_touch -am 1019183498 'demo/Makefile' &&
  chmod 0644 'demo/Makefile' ||
  echo 'restore of demo/Makefile failed'
  shar_count="`wc -c < 'demo/Makefile'`"
  test 288 -eq "$shar_count" ||
    echo "demo/Makefile: original size 288, current size $shar_count"
fi
# ============= demo/demo.f ==============
if test -f 'demo/demo.f' && test X"$1" != X"-c"; then
  echo 'x - skipping demo/demo.f (file already exists)'
else
  echo 'x - extracting demo/demo.f (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'demo/demo.f' &&
X      program demo
c
c     I/O recursion error.
c
X      double precision f
X      external f
X      write (6,'(f7.3)') f(-2d0)
X      end
X
X      double precision function f(x)
X      double precision x
X      if (x.lt.0d0) call bomb ('x < 0')
X      f=sqrt(x)
X      return
X      end
X
X      subroutine bomb(c)
X      character*(*) c
X      write (6,'(''oops: '',a)') c
X      stop 1
X      end
X    
SHAR_EOF
  $shar_touch -am 1019185698 'demo/demo.f' &&
  chmod 0644 'demo/demo.f' ||
  echo 'restore of demo/demo.f failed'
  shar_count="`wc -c < 'demo/demo.f'`"
  test 388 -eq "$shar_count" ||
    echo "demo/demo.f: original size 388, current size $shar_count"
fi
# ============= demo/README ==============
if test -f 'demo/README' && test X"$1" != X"-c"; then
  echo 'x - skipping demo/README (file already exists)'
else
  echo 'x - extracting demo/README (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'demo/README' &&
Hi,
X
In a statement like
X
write (6,100) f(x)
X
if the external function f starts a write statement, I get:
X
I/O recursion: I/O started while already doing I/O
X
same thing with f2c.
X
below is a quick demo program and output. I'm using egcs, see below
for more details.  Not certain this is a bug w/r/t f77 standard, but
it's not the best behavior.  In my case the function subprogram was
trying to issue a sensible error message, but never was able.
X
version info:
X
tcraft:/tmp/demo: g77 -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
tcraft:/tmp/demo: config.guess
i586-pc-linux-gnulibc1
tcraft:/tmp/demo: uname -a
Linux tcraft 2.0.35 #20 Fri Oct 9 02:54:12 EDT 1998 i586 unknown
X
Judah Milgram
milgram@eng.umd.edu
X
Running g77 version:
X./demo
I/O recursion: I/O started while already doing I/O
apparent state: unit 6 (unnamed)
last format: (f7.3)
lately writing sequential formatted external IO
make: *** [check] IOT trap/Abort
Running f2c version:
X./demo-f2c
I/O recursion: I/O started while already doing I/O
apparent state: unit 6 (unnamed)
last format: (f7.3)
lately writing sequential formatted external IO
make: *** [check] IOT trap/Abort
Running ftnchek
ftnchek demo.f
X
FTNCHEK Version 2.9 April 1996
X
File demo.f:
X 0 syntax errors detected in file demo.f
SHAR_EOF
  $shar_touch -am 1019190098 'demo/README' &&
  chmod 0644 'demo/README' ||
  echo 'restore of demo/README failed'
  shar_count="`wc -c < 'demo/README'`"
  test 1350 -eq "$shar_count" ||
    echo "demo/README: original size 1350, current size $shar_count"
fi
exit 0



More information about the Gcc-bugs mailing list