PGI Fortran Reference Copyright © 2005, Stmicroelectronics, Inc
Total Page:16
File Type:pdf, Size:1020Kb
PGI® Fortran Reference The Portland Group STMicroelectronics 9150 SW Pioneer Court, Suite H Wilsonville, OR 97070 www.pgroup.com While every precaution has been taken in the preparation of this document, The Portland Group™, a wholly-owned subsidiary of STMicroelectronics, makes no warranty for the use of its products and assumes no responsibility for any errors that may appear, or for damages resulting from the use of the information contained herein. STMicroelectronics retains the right to make changes to this information at any time, without notice. The software described in this document is distributed under license from STMicroelectronics and may be used or copied only in accordance with the terms of the license agreement. No part of this document may be reproduced or transmitted in any form or by any means, for any purpose other than the purchaser's personal use without the express written permission of STMicroelectronics. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this manual, STMicroelectronics was aware of a trademark claim. The designations have been printed in caps or initial caps. Thanks is given to the Parallel Tools Consortium and, in particular, to the High Performance Debugging Forum for their efforts. PGF90, PGF95, PGC++, Cluster Development Kit, CDK and The Portland Group are trademarks and PGI, PGHPF, PGF77, PGCC, PGPROF, and PGDBG are registered trademarks of STMicroelectronics, Inc. Other brands and names are the property of their respective owners. The use of STLport, a C++ Library, is licensed separately and license, distribution and copyright notice can be found in online documentation for a given release of the PGI compilers and tools. PGI Fortran Reference Copyright © 2005, STMicroelectronics, Inc. All rights reserved. Printed in the United States of America First Printing: Release 6.0, March, 2005 Part Number: 2410-990-990-0297 Technical support: [email protected] Sales: [email protected] Web: www.pgroup.com Table of Contents PREFACE......................................................................................................................................15 AUDIENCE DESCRIPTION..............................................................................................................15 COMPATIBILITY AND CONFORMANCE TO STANDARDS.................................................................15 ORGANIZATION............................................................................................................................16 HARDWARE AND SOFTWARE CONSTRAINTS ................................................................................17 CONVENTIONS .............................................................................................................................17 RELATED PUBLICATIONS .............................................................................................................18 1 LANGUAGE OVERVIEW..................................................................................................20 1.1 ELEMENTS OF A FORTRAN PROGRAM UNIT......................................................................20 1.1.1 Statements ...............................................................................................................20 1.1.2 Free and Fixed Source ............................................................................................21 1.1.3 Statement Ordering .................................................................................................21 1.2 THE FORTRAN CHARACTER SET ......................................................................................22 1.3 FREE FORM FORMATTING ................................................................................................23 1.4 FIXED FORMATTING.........................................................................................................24 1.4.1 Column Formatting.................................................................................................24 1.4.2 Fixed Format Label Field .......................................................................................24 1.4.3 Fixed Format Continuation Field ...........................................................................24 1.4.4 Fixed Format Statement Field.................................................................................25 1.4.5 Fixed Format Debug Statements.............................................................................25 1.4.6 Tab Formatting .......................................................................................................25 1.4.7 Fixed Input File Format – Summary.......................................................................25 1.5 INCLUDING FORTRAN SOURCE FILES ...............................................................................26 1.6 THE COMPONENTS OF FORTRAN STATEMENTS ................................................................26 1.6.1 Symbolic Names ......................................................................................................27 1.7 EXPRESSIONS ...................................................................................................................27 1.7.1 Expression Precedence Rules..................................................................................28 1.7.2 Arithmetic Expressions............................................................................................29 1.7.3 Relational Expressions............................................................................................30 1.7.4 Logical Expressions ................................................................................................31 1.7.5 Character Expressions ............................................................................................32 1.7.6 Character Concatenation........................................................................................32 1.8 SYMBOLIC NAME SCOPE..................................................................................................32 1.9 ASSIGNMENT STATEMENTS..............................................................................................32 1.9.1 Arithmetic Assignment ...................................................................................................33 1.9.2 Logical Assignment Statement .......................................................................................33 1.9.3 Character Assignment....................................................................................................34 1.10 LISTING CONTROLS..........................................................................................................35 1.11 OPENMP DIRECTIVES ......................................................................................................35 1.12 HPF DIRECTIVES .............................................................................................................35 i 2 FORTRAN DATA TYPES................................................................................................... 37 2.1 INTRINSIC DATA TYPES ................................................................................................... 37 2.1.1 Kind Parameter....................................................................................................... 37 2.1.2 Number of Bytes Specification ................................................................................ 38 2.2 CONSTANTS ..................................................................................................................... 40 2.2.1 Integer Constants.................................................................................................... 40 2.2.2 Binary, Octal and Hexadecimal Constants............................................................. 41 2.2.3 Real Constants ........................................................................................................ 41 2.2.4 Integer Constants.................................................................................................... 42 2.2.5 Complex Constants ................................................................................................. 42 2.2.6 Logical Constants ................................................................................................... 43 2.2.7 Character Constants ............................................................................................... 43 2.2.8 PARAMETER Constants......................................................................................... 44 2.3 DERIVED TYPES............................................................................................................... 44 2.4 ARRAYS........................................................................................................................... 45 2.4.1 An Array Declaration Element ............................................................................... 45 2.4.2 Deferred Shape Arrays ........................................................................................... 46 2.4.3 Subscripts................................................................................................................ 46 2.4.4 Character Substring................................................................................................ 46 2.5 FORTRAN POINTERS AND TARGETS ................................................................................. 47 2.6 FORTRAN BINARY, OCTAL AND HEXADECIMAL