Sun Logo

Fortran User's Guide

Suntrademark Studio 11




Before You Begin

Typographic Conventions

Shell Prompts

Supported Platforms

Accessing Sun Studio Software and Man Pages

Accessing Compilers and Tools Documentation

Accessing Related Solaris Documentation

Resources for Developers

Contacting Sun Technical Support

Sending Your Comments

1. Introduction

1.1 Standards Conformance

1.2 Features of the Fortran 95 Compiler

1.3 Other Fortran Utilities

1.4 Debugging Utilities

1.5 Sun Performance Library

1.6 Interval Arithmetic

1.7 Man Pages

1.8 README Files

1.9 Command-Line Help

2. Using Fortran 95

2.1 A Quick Start

2.2 Invoking the Compiler

2.2.1 Compile-Link Sequence

2.2.2 Command-Line File Name Conventions

2.2.3 Source Files

2.2.4 Source File Preprocessors

2.2.5 Separate Compiling and Linking

2.2.6 Consistent Compiling and Linking

2.2.7 Unrecognized Command-Line Arguments

2.2.8 Fortran 95 Modules

2.3 Directives

2.3.1 General Directives

2.3.2 Parallelization Directives

2.4 Library Interfaces and

2.5 Compiler Usage Tips

2.5.1 Determining Hardware Platform

2.5.2 Using Environment Variables

2.5.3 Memory Size

3. Fortran Compiler Options

3.1 Command Syntax

3.2 Options Syntax

3.3 Options Summary

3.3.1 Commonly Used Options

3.3.2 Macro Flags

3.3.3 Backward Compatibility and Legacy Options

3.3.4 Obsolete Option Flags

3.4 Options Reference










































































-o name









-Qoption pr ls


-R ls






























-xbinopt={prepare | off}
































-xmodel=[small | kernel | medium]































-xvector[=[{yes|no}] [[no%]lib, [no%]simd, %none] ]


4. Fortran 95 Features and Differences

4.1 Source Language Features

4.1.1 Continuation Line Limits

4.1.2 Fixed-Form Source Lines

4.1.3 Source Form Assumed

4.1.4 Limits and Defaults

4.2 Data Types

4.2.1 Boolean Type

4.2.2 Abbreviated Size Notation for Numeric Data Types

4.2.3 Size and Alignment of Data Types

4.3 Cray Pointers

4.3.1 Syntax

4.3.2 Purpose of Cray Pointers

4.3.3 Declaring Cray Pointers and Fortran 95 Pointers

4.3.4 Features of Cray Pointers

4.3.5 Restrictions on Cray Pointers

4.3.6 Restrictions on Cray Pointees

4.3.7 Usage of Cray Pointers

4.4 STRUCTURE and UNION (VAX Fortran)

4.5 Unsigned Integers

4.5.1 Arithmetic Expressions

4.5.2 Relational Expressions

4.5.3 Control Constructs

4.5.4 Input/Output Constructs

4.5.5 Intrinsic Functions

4.6 Fortran 2003 Features

4.6.1 Interoperability with C Functions

4.6.2 IEEE Floating-Point Exception Handling

4.6.3 Command-Line Argument Intrinsics

4.6.4 PROTECTED Attribute

4.6.5 Fortran 2003 Asynchronous I/O

4.6.6 Extended ALLOCATABLE Attribute

4.6.7 VALUE Attribute

4.6.8 Fortran 2003 Stream I/O

4.6.9 Fortran 2003 Formatted I/O Features

4.7 Additional I/O Extensions

4.7.1 I/O Error Handling Routines

4.7.2 Variable Format Expressions

4.7.3 NAMELIST Input Format

4.7.4 Binary Unformatted I/O

4.7.5 Miscellaneous I/O Extensions

4.8 Directives

4.8.1 Form of Special f95 Directive Lines

4.8.2 FIXED and FREE Directives

4.8.3 Parallelization Directives

4.9 Module Files

4.9.1 Searching for Modules

4.9.2 The -use=list Option Flag

4.9.3 The fdumpmod Command

4.10 Intrinsics

4.11 Forward Compatibility

4.12 Mixing Languages

5. FORTRAN 77 Compatibility: Migrating to Fortran 95

5.1 Compatible f77 Features

5.2 Incompatibility Issues

5.3 Linking With f77-Compiled Routines

5.3.1 Fortran 95 Intrinsics

5.4 Additional Notes About Migrating to the f95 Compiler

A. Runtime Error Messages

A.1 Operating System Error Messages

A.2 f95 Runtime I/O Error Messages

B. Features Release History

B.1 Sun Studio 11 Fortran Release

B.2 Sun Studio 10 Fortran Release:

B.3 Sun Studio 9 Fortran Release:

B.4 Sun Studio 8 Fortran Release:

B.5 Sun ONE Studio 7, Compiler Collection (Forte Developer 7) Release:

C. Legacy -xtarget Platform Expansions

D. Fortran Directives Summary

D.1 General Fortran Directives

D.2 Special Fortran 95 Directives

D.3 Fortran 95 OpenMP Directives

D.4 Sun Parallelization Directives

D.5 Cray Parallelization Directives