Sun Logo


Fortran User's Guide

Suntrademark Studio 8

817-5067-10



Contents

Tables

Before You Begin

Typographic Conventions

Shell Prompts

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 system.inc

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

-a

-aligncommon[=n]

-ansi

-arg=local

-autopar

-B{static|dynamic}

-C

-c

-cg89

-cg92

-copyargs

-Dname[=def]

-dalign

-dbl_align_all={yes|no}

-depend{=yes|no}

-dn

-dryrun

-d{y|n}

-e

-erroff=taglist

-errtags[={yes|no}]

-explicitpar

-ext_names=e

-F

-f

-f77[=list]

-fast

-fixed

-flags

-fnonstd

-fns[={no|yes}]

-fpover[={yes|no}]

-fpp

-free

-fround=r

-fsimple[=n]

-ftrap=t

-G

-g

-hname

-help

-Ipath

-inline=[%auto][[,][no%]f1,...[no%]fn]

-iorounding=mode

-Kpic

-KPIC

-Lpath

-lx

-libmil

-loopinfo

-Mpath

-moddir=path

-mp={%none|sun|cray}

-mt

-native

-noautopar

-nodepend

-noexplicitpar

-nolib

-nolibmil

-noreduction

-norunpath

-O[n]

-O

-O1

-O2

-O3

-O4

-O5

-o name

-onetrip

-openmp[=keyword]

-PIC

-p

-pad[=p]

-parallel

-pg

-pic

-Qoption pr ls

-qp

-R ls

-r8const

-reduction

-S

-s

-sb

-sbfast

-silent

-stackvar

-stop_status=yn

-temp=dir

-time

-U

-Uname

-u

-unroll=n

-use=list

-V

-v

-vax=keywords

-vpara

-w[n]

-Xlist[x]

-xa

-xalias[=keywords]

-xarch=isa

-xassume_control[=keywords]

-xautopar

-xcache=c

-xcg89

-xcg92

-xcheck=keyword

-xchip=c

-xcode=addr

-xcommonchk[={no|yes}]

-xcrossfile[=n]

-xdepend

-xexplicitpar

-xF

-xhasc[={yes|no}]

-xhelp=h

-xia[=v]

-xild{off|on}

-xinline=list

-xinterval[=v]

-xipo[={0|1|2}]

-xjobs=n

-xknown_lib=library_list

-xlang=f77

-xlibmil

-xlibmopt

-xlic_lib=sunperf

-xlicinfo

-xlinkopt[=level]

-xloopinfo

-xmaxopt[=n]

-xmemalign[=<a><b>]

-xnolib

-xnolibmil

-xnolibmopt

-xOn

-xopenmp

-xpad

-xpagesize=size

-xpagesize_heap=size

-xpagesize_stack=size

-xparallel

-xpg

-xpp={fpp|cpp}

-xprefetch[=a[,a]]

-xprefetch_level=n

-xprofile=p

-xprofile_ircache[=path]

-xprofile_pathmap=collect_prefix:use_prefix

-xrecursive

-xreduction

-xregs=r

-xs

-xsafe=mem

-xsb

-xsbfast

-xspace

-xtarget=t

-xtime

-xtypemap=spec

-xunroll=n

-xvector[={yes|no}]

-ztext

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 2000 Features

4.6.1 Interoperability with C Functions

4.6.2 IEEE Floating-Point Exception Handling

4.6.3 PROTECTED Attribute

4.6.4 Fortran 2000 Asynchronous I/O

4.6.5 Extended ALLOCATABLE Attribute

4.6.6 VALUE Attribute

4.6.7 Fortran 2000 Stream I/O

4.6.8 Fortran 2000 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 8 Fortran Release:

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

C. Less Common -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

Index