Sun Studio 12 Update 1: Fortran User's Guide

Chapter 5 FORTRAN 77 Compatibility: Migrating to Sun Studio Fortran

The Fortran compiler, f95, will compile most legacy FORTRAN 77 programs, including programs utilizing non-standard extensions previously compiled by the f77 compiler.

f95 will accept many of these FORTRAN 77 features directly. Others require compiling in FORTRAN 77 compatibility mode (f95 -f77).

This chapter describes the FORTRAN 77 features accepted by f95, and lists those f77 features that are incompatible with f95. For details on any of the non-standard FORTRAN 77 extensions that were accepted by the f77 compiler, see the FORTRAN 77 Language Reference manual at

See Chapter Chapter 4, Sun Studio Fortran Features and Differences for other extensions to the Fortran language accepted by the f95 compiler.

f95 will compile standard-conforming FORTRAN 77 programs. To ensure continued portability, programs utilizing non-standard FORTRAN 77 features should migrate to standard-conforming Fortran 95/2003. Compiling with the -ansi option will flag all non-standard usages in your program.

5.1 Compatible f77 Features

f95 accepts the following non-standard features of the FORTRAN 77 compiler, f77, either directly or when compiling in -f77 compatibility mode:

Source Format


Data Types, Declarations, and Usage:

Programs, Subroutines, Functions, and Executable Statements:


For details on the syntax and semantics of non-standard language extensions, see the FORTRAN 77 Language Reference at

5.2 Incompatibility Issues

The following lists known incompatibilities that arise when compiling and testing legacy f77 programs with this release of f95. These are due to either missing comparable features in f95, or differences in behavior. These items are non-standard extensions to Fortran 77 supported in f77 but not in f95.

Source Format


Data Types, Declarations, and Usage:

Programs, Subroutines, Functions, Statements:

Command-line Options:

f77 Library Routines Not Supported by f95:

5.3 Linking With f77-Compiled Routines

5.3.1 Fortran Intrinsics

The Fortran standard supports intrinsic functions that FORTRAN 77 did not have. The full set of Fortran intrinsics, including non-standard intrinsics, appears in the Fortran Library Reference manual.

If you use any of the intrinsic names listed in the Fortran Library Reference as a function name in your program, you must add an EXTERNAL statement for f95 to use your routine rather than the intrinsic one.

The Fortran Library Reference also lists all the intrinsics recognized by earlier releases of the f77 compiler. The f95 compiler recognizes these names as intrinsics as well.

Compiling with -f77=intrinsics limits the compiler’s recognition of intrinsic functions to just those that were known to the f77 compiler, ignoring the Fortran intrinsics.

5.4 Additional Notes About Migrating to the f95 Compiler