[comp.unix.aux] f77 limitations

england@csd4.csd.uwm.edu (Walter B England) (08/31/89)

There are two problems which severely limit the utility of f77 on A/UX
1.1.  These are described and illustrated in the following with
source, explanations, and -- where possible -- input/output.
Everything was run on a mac IIx.  For what I do, f77 cannot be used
until there is a workaround or these are fixed.

Problem 1: f77 does not recognize common as a global (external).
Consequently, routines which share common must appear in the same
file.  Porting large fortran source is then very difficult.

      integer array(10), array2(30)
      common /block/ array
      common /bloc2/ array2
      do 1942 i = 1, 10
 1942 array(i) = i
      print *, ' main: array', array   
      do 1943 k = 1, 30
 1943 array2(k) = -k
      print *, ' main: array2', array2   
      call sub1
      end
      subroutine sub1
      integer array(10), array2(30)
      common /block/ array
      common /bloc2/ array2
      print *, ' sub1: array', array   
      print *, ' sub1: array2', array2   
      return
      end
***** Here is screen output after compilation with A/UX 1.1 f77 ******
  main: array 1 2 3 4 5 6 7 8 9 10
  main: array2 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18
 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30
  sub1: array 0 0 0 0 0 0 0 0 0 0
  sub1: array2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
***** Here is output from nm main.o *****
Symbols from main.o:

Name                  Value   Class        Type         Size   Line  Section

main.f              |        | file |                  |      |     |
v%1                 |     372|static|                  |      |     |.bss
v%3                 |     376|static|                  |      |     |.bss
MAIN__              |       0|extern|                  |      |     |.text
block_              |     380|static|                  |      |     |.bss
bloc2_              |     420|static|                  |      |     |.bss
s_wsle              |       0|extern|                  |      |     |
do_lio              |       0|extern|                  |      |     |
e_wsle              |       0|extern|                  |      |     |
sub1_               |       0|extern|                  |      |     |
v%2                 |     340|static|                  |      |     |.data
v%4                 |     356|static|                  |      |     |.data
***** Here is output from nm sub1.o *****
Symbols from sub1.o:

Name                  Value   Class        Type         Size   Line  Section

sub1.f              |        | file |                  |      |     |
sub1_               |       0|extern|                  |      |     |.text
block_              |     300|static|                  |      |     |.bss
bloc2_              |     340|static|                  |      |     |.bss
s_wsle              |       0|extern|                  |      |     |
do_lio              |       0|extern|                  |      |     |
e_wsle              |       0|extern|                  |      |     |
v%1                 |     268|static|                  |      |     |.data
v%2                 |     284|static|                  |      |     |.data



Problem 2: f77 will not accept negative integers smaller than
-999,999,999.  (I didn't run all negative integers between -(2**31-1)
and -10**9, but none I tried worked.)  It is difficult to exploit
masking and bits operations from cc with this limitation.

c main program
c  run this on A/UX 1.1 f77 with input
c     1) m = 2**31 - 1
c     2) m = 1000000000
c    3) m = 999999999
c  1) & 2) fail at the statement m = -m and dump core.
c  3) runs without error.
      read *, m
      print *, ' 32 bit integer is ', m
      print *, 'next statement sets m = -m '
      m = - m
      print *, ' negative of 32 bit integer is ', m
      end

The corresponding C-language program on A/UX 1.1 works ok.

Finally, f77 limits the user to file numbers <= 19.  I would like to
change this to <= 99.

--
Walter B. England; Chemistry Department; University of Wisconsin-Milwaukee
3210 North Cramer Street; Milwaukee, WI 53201
ARPANET: england@csd4.csd.uwm.edu
USENET: uwvax!uwcsd1!uwcsd4!england