Fortran User's Guide

Compatibility with FORTRAN 77

Source

Standard-conforming FORTRAN 77 source code is compatible with Sun Fortran 90. Use of non-standard extensions, such as VMS Fortran features, are not compatible and may not compile with Sun Fortran 90.

Both f77 and f90 treat all source lines as if they were lowercase (except in quoted character strings. However, unlike f77, f90 has no -U option to force the compiler to be sensitive to both upper and lower case. This may present a problem when mixing f77 and f90 compiled routines. Since a routine compiled by f90 will treat CALL XyZ the same as CALL XYz, and treat them both as if they were CALL xyz, care must be taken to rearrange the way these calls are made. A similar situation will exist when trying to define entry points in f90 compiled routines that are differentiated by case. The clue to potential problems would be the need to use -U with f77.

Linking with f77-Compiled Routines

Example: f90 main calls a routine from the FORTRAN 77 library.


demo% cat tdtime.f90
        REAL e, dtime, t(2)
        e = dtime( t )
        DO i = 1, 100000
           as = as + cos(sqrt(float(i)))
        END DO
        e = dtime( t )
        PRINT *, 'elapsed:', e, ', user:', t(1), ', sys:', t(2)
        END
demo% f90 tdtime.f90
demo% a.out
elapsed: 0.14 , user: 0.14 , sys: 0.0E+0
demo% 

See dtime(3F).

I/O

f77 and f90 are generally I/O compatible for binary I/O, since f90 links to the f77 compatibility library.

Such compatibility includes the following two situations:

The numbers read back in may or may not equal the numbers written out.

Intrinsics

The Fortran 90 standard supports the following new intrinsic functions that FORTRAN 77 does not have.

If you use one of these names in your program, you must add an EXTERNAL statement to make f90 use your function rather than the intrinsic one.

Fortran 90 intrinsics:

"ADJUSTL,ADJUSTR,ALL,ALLOCATED,ANY,BIT_SIZE,COUNT,CSHIFT, DIGITS,DOT_PRODUCT,EOSHIFT,EPSILON,EXPONENT,HUGE,KIND, LBOUND,LEN_TRIM,MATMUL,MAXEXPONENT,MAXLOC,MAXVAL,MERGE, MINEXPONENT,MINLOC,MINVAL,NEAREST,PACK,PRECISION,PRESENT, PRODUCT,RADIX,RANGE,REPEAT,RESHAPE,RRSPACING,SCALE,SCAN, SELECTED_INT_KIND,SELECTED_REAL_KIND,SET_EXPONENT,SHAPE, SIZE,SPACING,SPREAD,SUM,TINY,TRANSFER,TRANSPOSE,UBOUND, UNPACK,VERIFY"