Sun Studio 12: Fortran User's Guide

3.4.27 –f77[=list]

Select Fortran 77 compatibility mode.

This option flag enables porting legacy Fortran 77 source programs, including those with language extensions accepted by the f77 compiler, to the f95 Fortran 95 compiler.

list is a comma-separated list selected from the following possible keywords:




Enable all the Fortran 77 compatibility features. 


Disable all the Fortran 77 compatibility features. 


Accept backslash as an escape sequence in character strings. 


Allow input formats accepted by f77.


Limit recognition of intrinsics to only Fortran 77 intrinsics. 


Accept Fortran 77 usage of logical variables, such as: 

- assigning integer values to logical variables- allowing arithmetic expressions in logical conditional statements, with .NE.0 representing .TRUE.- allowing relational operators .EQ. and .NE. with logical operands


Allow miscellaneous f77 Fortran 77 extensions.


Generate f77-style formatted output, including list-directed and NAMELIST output.


Allow non-integer expressions as array subscripts. 


Enable f77-style TAB-formatting, including unlimited source line length. No blank padding will be added to source lines shorter than 72 characters.

All keywords can be prefixed by no% to disable the feature, as in:


The default, when -f77 is not specified, is -f77=%none. Using -f77 without a list is equivalent to specifying -f77=%all.

Exceptions Trapping and -f77:

Specifying -f77 does not change the Fortran 95 trapping mode, which is -ftrap=common. Fortran 95 differs from the Fortran 77 compiler’s behavior regarding arithmetic exception trapping. The Fortran 77 compiler allowed execution to continue after an arithmetic exception occurred. Compiling with -f77 also causes the program to call ieee_retrospective on program exit to report on any arithmetic exceptions that might have occurred. Specify -ftrap=%none following the -f77 option flag on the command line to mimic the original Fortran 77 behavior.

See 4.12 Mixing Languages for complete information on f77 compatibility and Fortran 77 to Fortran 95 migration.

See also the -xalias flag for handling non-standard programming syndromes that may cause incorrect results.