Sun Java Solaris Communities My SDN Account Join SDN
 
Sun Studio

Fortran 95 Features by Release

 

This document allows you to compare the features added to the Sun Fortran compiler for the following compiler and tools releases:

  • Sun Studio 12 (SS12): Fortran 95 compiler version 8.3 (SPARC and x86, Solaris and Linux) June 2007
  • Sun Studio 11 (SS11): Fortran 95 compiler version 8.2 (SPARC and x86) released November 2005
  • Sun Studio 10 (SS10): Fortran 95 compiler version 8.1 (SPARC and x86) released January 2005
  • Sun Studio 9 (SS9): Fortran 95 compiler version 8.0 (SPARC and x86) released July 2004
  • Sun ONE Studio 8 (S1S8): Fortran 95 compiler version 7.1 (SPARC only) released May 2003 (last separate Fortran 77 compiler released with Sun ONE Studio 7, May 2002)
  • Forte Developer 6 update 2 (FD6u2): Fortran 95 compiler version 6.2, Fortran 77 compiler version 5.3 released July 2001 (Both compilers SPARC only)
  • Forte Developer 6 (FD6): Fortran 95 compiler version 6.0, Fortran 77 compiler version 5.1 released May 2000 (Both compilers SPARC only)

Release
Feature SS12
Linux support - Sun Studio Compilers available on Linux x86 platforms






X
-m32 and -m64 options to specify 32-bit or 64-bit memory model






X
-xarch=sse3 and -xarch=sse3a options on x86 platforms






X
-fast includes -xregs=frameptr on x86 platforms






X
New SPARC platform support: -xtarget=sparc64vi, -xtarget=ultraT2  and -xarch=sparcfmaf






X
-xinstrument=datarace enables thread analysis






X
-fma=fused enables fused multiply-add instructions on SPARC






X
Support for interval arithmetic with -xarch=sse2 -xia






X
A New -xmodel Option To Specify x64 Memory Models
 
 
 
 
 
X
X
Support For x86 -xpagesize Options
 
 
 
 
 
X
X
New -xarch Flags For x64 Development
 
 
 
 
 
X
X
Enhancements to the STACKSIZE Environment Variable
 
 
 
 
 
X
X
New UltraSPARC T1 and UltraSPARC IVplus Targets
 
 
 
 
 
X
X
Compiling for AMD-64 Processors
 
 
 
 
X
X
X
File sharing between big-endian and little-endian platforms
 
 
 
 
X
X
X
OpenMP available on Solaris OS x86 platforms
 
 
 
 
X
X
X
OpenMP option -openmp=stubs no longer supported
 
 
 
 
X
X
X
f95 on Solaris OS x86 Platforms
 
 
 
X
X
X
X
Improved Runtime Performance
 
 
 
X
X
X
X
Fortran 2003 Command-Line Intrinsics
 
 
 
X
X
X
X
New and Changed f95 Command-Line Options
 
 
 
X
X
X
X
Default SPARC Architecture is v8plus
 
 
 
X
X
X
X
OpenMP: Maximum Number of Threads Increased
 
 
 
X
X
X
X
Enhanced -openmp option
 
 
X
X
X
X
X
OpenMP support for explicit threading
 
 
X
X
X
X
X
Multi-processor compilation
 
 
X
X
X
X
X
Fortran 2003 features
 
 
X
X
X
X
X
Enhanced compatibility with legacy f77
 
 
X
X
X
X
X
Faster profiling
 
 
X
X
X
X
X
ALLOCATABLE Attribute Extended
 
X
X
X
X
X
X
VALUE Attribute from Fortran 2000
 
X
X
X
X
X
X
OpenMP 2.0 Fortran API Supported
 
X
X
X
X
X
X
OpenMP Library Interface
 
X
X
X
X
X
X
Interprocedural Optimiization (-xipo)
 
X
X
X
X
X
X
VAX Fortran Structures
 
X
X
X
X
X
X
Compliant with Fortran 95 standard
X
X
X
X
X
X
X
Enhanced debugging of optimized code
X
X
X
X
X
X
X
f77 compiler flags implemented in f95
X
X
X
X
X
X
X
New f95 flags
X
X
X
X
X
X
X
OpenMP interfaces supported
X
X
X
X
X
X
X
Interval arithmetic supported
X
X
X
X
X
X
X

Sun Studio 12 Fortran 95 New Features

This section describes new and changed features for this release of Fortran 95. For details on any of the compiler options, see the Fortran User's Guide and the f95(1) man page.

New Features and Updates Common To All Compilers on SPARC and x86 Platforms

A New Way To Specify 32-bit or 64-bit Address Model

You no longer need use the -xarch option to specify a 32-bit or 64-bit address model (LP64 versus ILP32). Two new options make it easier:

  • -m32 specifies the ILP32 model: 32-bit ints, longs, and pointer types.

  • -m64 specifies the LP64 model: 32-bit ints, 64-bit longs and pointers types. (Note that -m64 is the default on Linux platforms.)

Deprecated -xarch Flags and Their Replacements Across SPARC and x86

  • Use -m64 in place of -xarch=generic64

  • Use -m64 -xarch=native in place of -xarch=native64

If you are using -xarch=v9 or -xarch=amd64 to specify a 64-bit address model, use just -m64 instead. No -xarch value is required.

Deprecated -xarch Flags and Their Replacements on SPARC Only

  • Use -xarch=sparc in place -xarch=v8plus

  • Use -xarch=sparcvis in place of -xarch=v8plusa

  • Use -xarch=sparcvis2 in place of -xarch=v8plusb

  • Use -xarch=sparc -m64 in place of -xarch=v9

  • Use -xarch=sparcvis -m64 in place of -xarch=v9a

  • Use -xarch=sparcvis2 -m64 in place of -xarch=v9b

Deprecated -xarch Flags and Their Replacements on x86 Only

  • Use -xarch=sse2 -m64 in place of -xarch=amd64.

  • Use -xarch=sse2a -m64 in place of -xarch=amd64a.

Disallowed Combinations and Warnings

The compilers do not allow the combination of a deprecated -xarch value and the new -m32, -m64 options on the command line. For example, specifying -xarch=v9 -m32 is now a fatal error. Specifying -xarch=sparc -xarch=v9 is also a fatal error.

Some older -xarch values do not have 64-bit counterparts. You cannot combine the following -xarch options with -m64 on the command line:

  For SPARC platforms: -xarch=v7, -xarch=v8, -xarch=v8a
  For x86 platforms: -xarch=386, -xarch=pentium_pro, -xarch=pentium_proa, -xarch=sse, -xarch=ssea

If you specify a 32-bit -xarch value followed by -m64, the compiler does not issue a warning. For example -m64 -fast or -fast -m64 are allowed. However, if you specify a 64-bit -xarch value followed by -m32, the compiler issues a warning that -m32 overrides the -xarch value. This situation does not occur using macro options, only when an -xarch option has been explicitly specified.

New x86 Features and Updates Common To All Compilers

The following are new x86 flags for the -xarch option:

  • -xarch=sse3 specifies that the compiler should generate instructions based on both the SSE3 and SSE2 architectures.

  • -xarch=sse3a specifies that the compiler should generate instructions based on the SSE3, SSE2 and AMD extended architectures as well as the 3DNow extensions.

Changes to -fast Option

The -fast option on x86 now includes -xregs=frameptr, which means that the compiler can use the frameptr register (%ebp on IA32, %rbp on AMD64) as a general purpose register to generate code for all the compilation units. Consequently frame pointers will not be generated in each function or routine.

However, if you want to override this new behavior, specify -xregs=no%frameptr after -fast in the compilation command and the frameptr register will not be used as a general purpose register. The following example demonstrates how to override the -fast default for -xregs:

      cc -fast -xregs=no%frameptr foo.c

New SPARC Features and Updates Common To All Compilers

This release of the Sun Studio compilers includes support for the SPARC64 VI and UltraSPARC T2 processors. Use the following new options to specify these processors:

  • -xtarget=sparc64vi

  • -xtarget=ultraT2

You can also specify the following -xchip options to generate code for these processors without setting the -xarch value automatically as happens when you use -xtarget:

  • -xchip=sparc64vi

  • -xchip=ultraT2

You can also specify the -xarch values explicitly:

  • -xarch=[v8plusc|v9c] for the SPARC64 VI fused multiply-add instructions set architecture

  • -xarch=[v8plusv|v9v] for privileged and hyper-privileged code

New Math and Visual Instruction Set Support in SPARC64 VI

Specify the following new option if you want to use instructions from the SPARC-V9 instruction set including the UltraSPARC extensions, the Visual Instruction Set (VIS) version 1.0, the UltraSPARC-III extensions, the Visual Instruction Set (VIS) version 2.0, and the SPARC64 VI extensions for floating-point multiply-add:
  • -xarch=sparcfmaf

You must also specify -m32 or -m64 when you specify -xarch=sparcfmaf to get 32-bit code or 64-bit code respectively . When you specify -xarch=sparcfmaf, the compiler predefines the following new values:

  • -D__FP_FAST_FMA__

  • -D__FP_FAST_FMAF__

Note: You must use -xarch=sparcfmaf in conjunction with the new -fma=fused option detailed below and some optimization level in order for the compiler to find opportunities to use the multiply-add instructions automatically.

New Option for Floating-Point, Fused or Multiply-Add Instructions

Specify the following new option to enable or disable the automatic generation of floating-point, fused, multiply-add instructions:
  • -fma={none,fused}

The none value indicates that the compiler should not generate any floating-point, fused, or multiply-add instructions. The fused value allows the compiler to attempt to find opportunities to improve the performance of the code by using floating-point, fused, or multiply-add instructions.

Linux Support

This release of the Sun Studio compilers supports the Linux OS. See the release notes for processor and distro version requirements.

There are some limitations with f95 on Linux. See Section F. below for details.

The New Thread Analyzer

The following new compiler option causes the compiler to instrument your multi-threaded application for analysis by the new Thread Analyzer. 
  • -xinstrument[=[no%]datarace]

The default is -xinstrument=no%datarace.

Additional Notes:

  • Support for interval arithmetic on Solaris Intel platform with the -xarch=sse2 -xia options.

  • CAUTION messages issued when using the same symbols that are defined in different modules.This enhancement provides a CAUTION level message when the same symbols defined in different modules are imported by the USE statement. This helps isolating name duplication problems in large applications using third-party modules.

  • Faster compilation time for source files with many constant values.

  • Intrinsic functions called with UNSIGNED arguments improved.
  • Improved backward compatibility with old F77 objects produced by the Sun WorkShop 6 update 2 compiler.


Sun Studio 11 Fortran 95 New Features

This section describes new and changed features for this release of Fortran 95. For details on any of the compiler options, see the Fortran User's Guide and the f95(1) man page.

  • New -xmodel Option

    The new -xmodel option lets you specify the kernel, small, or medium memory models on the 64-bit AMD architecture. If the size of your global and static variables exceeds two gigabytes, specify -xmodel=medium. Otherwise, don't change the default -xmodel=small setting.

  • New Flags For The -xvector Option on x86 SSE2 Platforms

    The -xvector option enables automatic generation of calls to the vector library functions and/or the generation of the SIMD (Single Instruction Multiple Data) instructions. This option now offers the following expanded syntax on x86 SSE2 platforms:

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

    On SPARC platforms, only -xvector=yes or -xvector=no are enabled.

    You must use default rounding mode -fround=nearest when you use this option.

    -xvector=[no%]lib does [not]enable the compiler to transform math library calls within loops into single calls to the equivalent vector math routines when such transformations are possible. This could result in a performance improvement for loops with large loop counts.

    -xvector=[no%]simd does [not]direct the compiler to use the native x86 SSE SIMD instructions to improve performance of certain loops. The compiler can only accept this switch if the target architecture supports SIMD instructions. For example, you must specify -xarch=amd64 or -xarch=generic64. You must also specify an optimization level of -xO3 or above as well as -xdepend with -xvector=simd.

    You will get better performance if you specify both -xvector=simd and -fsimple=2 than with -xvector=simd alone. However, your floating point results can be slightly different because -fsimple=2 allows reordering of floating-point operations.

    The default is -xvector=%none. If you specify -xvector, but do not provide a flag, the compiler assumes -xvector=lib.

    The compiler includes the libmvec libraries in the load step. If you specify -xvector=lib at compile time, you must also specify it at link time.

    This option overrides previous instances so -xvector=%none overrides a previously specified -xvector=lib.

    The -xvector=yes option may be deprecated in a future release. Specify -xvector=lib instead.

    The -xvector=no option may be deprecated in a future release. Specify -xvector=no%lib,no%simd instead.

  • New -xarch Flags For x64 Development

    The -xarch option now supports the following new flags for development on the 64-bit x86 platform: amd64a, pentium_proa, ssea, sse2a. See the description of -xarch in the Sun Studio 11 f95(1) man page for more information.

  • STACKSIZE Environment Variable Enhancement:
    The syntax of the STACKSIZE environment variable has been enhanced to include a units keyword. Prior to this enhancement, the STACKSIZE environment variable accepted an integer that denoted the slave thread stacksize in Kilobytes.
    For example: % setenv STACKSIZE 8192 sets the slave thread stack size to 8 MB.
    WIth this release, the STACKSIZE environment variable now accepts a integer value with a qualifying letter that specifies whether the size is in Bytes, Kilobytes, Megabytes, or Gigabytes:
        1235B for 1235 Bytes, 1235K for 1235 Kilobytes, 1235M for 1235 Megabytes, 1235G for 1235 Gigabytes.
    The default for an integer value without a suffix letter is still Kilobytes.

  • -xpagesize Options Available on x86 Platforms:
    The -xpagesize, -xpagesize_heap, -xpagesize_stack compiler options for cc, CC, and f95 are now enabled for x86 platforms as well as SPARC.
        
  • New UltraSPARC T1 and UltraSPARC IVplus Targets:
    Sun Studio compilers generate code for these new SPARC hardware processors. Compile with -xtarget=ultraT1 or -xtarget=ultra4plus for these processors.

Sun Studio 10 Fortran 95 New Features

This section describes the new and changed features for the Sun Studio 10 Fortran 95 compiler. For details on any of the compiler options, see the Fortran User's Guide and the f95(1) man page.

Changes introduced in Sun Studio 10 Fortran 95 Compiler: 
  1. Compiling for AMD-64 Processors
  2. File sharing between big-endian and little-endian platforms
  3. OpenMP available on Solaris OS x86 platforms
  4. OpenMP option -openmp=stubs no longer supported
  1. Compiling for AMD-64 Processors

  2. This release introduces -xarch=amd64 and -xtarget=opteron for compiling applications to run on 64-bit x86 platforms. Details are in the combined component readme.
  3. File sharing between big-endian and little-endian platforms

  4. The new compiler flag -xfilebyteorder provides cross-platform support of binary I/O files. Details are in the f95 man page.
  5. OpenMP available on Solaris OS x86 platforms

  6. With this release of Sun Studio, the OpenMP API for shared-memory parallelism is available on Solaris x86 platforms as well as Solaris SPARC platforms. The same functionality is now enabled on both platforms. Details are in the combined component readme.
  7. OpenMP option -openmp=stubs no longer supported

  8. An OpenMP "stubs" library is provided for user's convenience. To compile an OpenMP program that calls OpenMP library functions but ignores the OpenMP pragmas, compile the program with the -openmp option and link the object files with the libompstubs.a library. For example: % f95 omp_ignore.c -lompstubs
    Linking with both libompstubs.a and the OpenMP runtime library libmtsk.so is unsupported and may result in unexpected behavior.

Sun Studio 9 Fortran 95 New Features

This section describes the new and changed features for the Sun Studio 9 Fortran 95 compiler. For details on any of the compiler options, see the Fortran User's Guide and the f95(1) man page.

  1. f95 on Solaris OS x86 Platforms
  2. Improved Runtime Performance
  3. Fortran 2003 Command-Line Intrinsics
  4. New and Changed f95 Command-Line Options
  5. Default SPARC Architecture is v8plus
  6. OpenMP: Maximum Number of Threads Increased
  7. OpenMP: Automatic Scoping of Variables
  1. f95 on Solaris OS x86 Platforms
    This release of Sun Studio makes the Fortran 95 compiler available on Solaris OS x86 platforms. Compile with -xtarget values generic, native, 386, 486, pentium, pentium_pro, pentium3, or pentium4, to generate executables on Solaris x86 platforms. The default on x86 platforms is -xtarget=generic

    The following f95 features are not yet implemented on x86 platforms and are only available on SPARC platforms:

    • Interval Arithmetic (compiler options -xia and -xinterval)
    • Quad (128-bit) Arithmetic (for example, REAL*16)
    • IEEE Intrinsic modules IEEE_EXCEPTIONS, IEEE_ARITHMETIC, and IEEE_FEATURES
    • The sun_io_handler module
    • Parallelization options such as -autopar, -parallel, -explitipar, and -openmp.

    The following f95 command-line options are only available on x86 platforms and not on SPARC platforms:

    • -fprecision, -fstore, -nofstore

    The following f95 command-line options are only available on SPARC platforms and not on x86 platforms:

    • -xcode, -xmemalign, -xprefetch, -xcheck, -xia, -xinterval, -xipo, -xjobs, -xlang, -xlinkopt, -xloopinfo, -xpagesize, -xprofile_ircache, -xreduction, -xvector, -depend, -openmp, -parallel, -autopar, -explicitpar, -vpara, -XlistMP

    Also, on x86 platforms -fast adds -nofstore

    More About Compiling for x86 Platforms

    • -xtarget x86 Platform Values and Expansions
      Two new -xtarget platform values are available for x86.
      -xtarget=pentium3 expands to -xarch=sse -xchip=pentium3 -xcache=16/32/4:256/32/4
      -xtarget=pentium4 expands to -xarch=sse2 -xchip=pentium4 -xcache=8/64/4:256/128/8

    • The new -xarch and -xchip values are:
      -xchip=pentium3 - optimize for Pentium 3 processor
      -xchip=pentium4 - optimize for Pentium 4 processor
      -xarch=sse - add the SSE instruction set to the pentium_pro instruction set
      -xarch=sse2 - add the SSE2 and SSE instruction sets to the pentium_pro instruction set

    • -fns is enabled only on pentium3 or pentium4 processors. When -xarch is not sse or sse2, -fns=yes is ignored. Otherwise, for SSE and SSE2 floating-point instructions, -fns=yes implies that underflows will be flushed to zero (FTZ) and that denormalized operands are treated as zero (DAZ). -fns=yes does not affect traditional x86 floating-point instructions.

    • SPECIAL x86 NOTE
      Programs compiled with -xarch={sse | sse2} to run on Solaris x86 SSE/SSE2 Pentium 4-compatible platforms must be run only on platforms that are SSE/SSE2 enabled. Running such programs on platforms that are not SSE/SSE2-enabled could result in segmentation faults or incorrect results occuring without any explicit warning messages. Patches to the OS and compilers to prevent execution of SSE/SSE2-compiled binaries on platforms not SSE/SSE2-enabled might be made available at a later date.

      OS releases starting with Solaris 9 update 6 are SSE/SSE2-enabled on Pentium 4-compatible platforms. Earlier versions of Solaris OS are not SSE/SSE2-enabled.

      This warning extends also to programs that employ .il inline assembly language functions or __asm() assembler code that utililize SSE/SSE2 instructions.

      If you compile and link in separate steps, always link using the compiler and with -xarch={sse | sse2} to ensure that the correct startup routine is linked.

      Arithmetic results on x86 may differ from results on SPARC due to the x86 80-byte floating-point registers. To minimize these differences, use the -fstore option or compile with -xarch=sse2 if the hardware supports SSE2.
  2. Improved Runtime Performance
    Runtime performance for most applications should improve significantly with this release. For best results, compile with high optimization levels -xO4 or -xO5. At these levels the compiler may now inline contained procedures, and those with assumed-shape, allocatable, or pointer arguments.
  3. Fortran 2003 Command-Line Intrinsics
    The Fortran 2003 draft standard introduces three new intrinsics for processing command-line arguments and environment variables. These have been implemented in this release of the f95 compiler. The new intrinsics are:
    • GET_COMMAND(command, length, status)
      Returns in command the entire command line that invoked the program.
    • GET_COMMAND_ARGUMENT(number, value, length, status)
      Returns a command-line argument in value.
    • GET_ENVIRONMENT_VARIABLE(name, value, length, status, trim_name)
      Return the value of an environment variable.
  4. New and Changed f95 Compiler Command-Line Options
    The following f95 command-line options are new in this release. See the f95(1) man page for details.

    • -xipo_archive={ none | readonly | writeback }
      Allow crossfile optimization to include archive (.a) libraries. (SPARC only)

      -xipo_archive=none
      No processing of archive files.

      -xipo_archive=readonly
      The compiler optimizes object files passed to the linker with object files compiled with -xipo that reside in the archive library (.a) before producing an executable.

      -xipo_archive=writeback
      The compiler optimizes object files passed to the linker with object files compiled with -xipo that reside in the archive library (.a) before producing an executable. Any object filed contained in the library that were optimized during the compilation are replaced with their optimized version.

      If you do not specify a setting for -xipo, the compiler assumes -xipo_archive=none.

    • -xprefetch_auto_type=[no%]indirect_array_access
      Generate indirect prefetches for a data arrays accessed indirectly. (SPARC only)

      [no%]indirect_array_access
      Does [Does not] generate indirect prefetches for the loops indicated by the option -xprefetch_level=[1|2|3] in the same fashion the prefetches for direct memory accesses are generated.

      If you do not specify a setting for -xprefetch_auto_type, the compiler sets it to -xprefetch_auto_type=[no%]indirect_array_access.

      The -xprefetch options are only available on SPARC platforms.

      Options such as -xdepend, -xrestrict, and -xalias_level can affect the aggressiveness used to determine the indirect prefetch candidates and therefore the aggressiveness of the automatic indirect prefetch insertion due to better memory alias disambiguation information.

    • -xprofile_pathmap=collect_prefix:use_prefix
      Set path mapping for profile data files. Use the -xprofile_pathmap option with the -xprofile=use option when profiling into a directory that is not the directory used when previously compiling with -xprofile=collect.
    The following command-line option defaults have changed with this release of f95.
    • The default for -xprefetch is -xprefetch=no%auto,explicit.
    • The default for -xmemalign is -xmemalign=8i; when compiling with one of the -xarch=v9 options the default is -xmemalign=8f.
    • The default for -xcode when compiling with one of the -xarch=v9 options is abs44.

    To compile with the defaults used in previous compiler releases, specify the following options explicitly:

    • -xarch=v8 -xmemalign=4s -xprefetch=no for 32-bit compilation
    • -xcode=abs64 -xprefetch=no for 64-bit compilation
  5. Default SPARC Architecture is V8PLUS
    The default SPARC architecture is no longer V7. Support for -xarch=v7 is limited in this Sun Studio 9 release. The new default is V8PLUS (UltraSPARC). Compiling with -xarch=v7 is treated as -xarch=v8 because the Solaris 8 OS only supports -xarch=v8 or better.

    To deploy on SPARC V8 systems (for example, SPARCStation 10), compile with -xarch=v8 explicitly. The provided system libraries run on SPARC V8 architectures.

    To deploy on SPARC V7 systems (for example, SPARCStation 1), compile with -xarch=v7 explicitly. The provided system libraries use the SPARC V8 instruction set. For the Sun Studio 9 release, only the Solaris 8 OS supports the SPARC V7 architecture. When a SPARC V8 instruction is encountered, the OS interprets the instruction in software. The program will run, but performance will be degraded.

  6. OpenMP: Maximum Number of Threads Increased
    The maximum number of threads for OMP_NUM_THREADS and the multitasking library has increased from 128 to 256.
  7. OpenMP: Automatic Scoping of Variables
    This release of the Fortran 95 compiler's implementation of the OpenMP API for shared-memory parallel programming features automatic scoping of variables in parallel regions. See the OpenMP API User's Guide for details. (OpenMP is only implemented on SPARC platforms for this release.)

For information about other Sun Studio components, see the What's New manual. You can find this manual as part of the documentation installed with the software, at file:/opt/SUNWspro/docs/index.html . You can also find the What's New manual in the Sun Studio 9 collection at http://docs.sun.com


Sun ONE Studio 8 Fortran 95 New Features

This section describes the new and changed features for the Fortran 95 compiler. For details on any of the compiler options, see the Fortran User's Guide and the f95(1) man page.

  1. Enhanced -openmp option
  2. OpenMP support for explicit threading
  3. Multi-processor compilation
  4. Making assertions with PRAGMA ASSUME
  5. Fortran 2000 features
  6. Enhanced compatibility with legacy f77
  7. I/O error handlers
  8. Unsigned integers
  9. Preferred stack/heap page size
  10. Faster profiling
  11. Enhanced "known libraries"
  12. Link-time optimization
  13. Initialization of local variables

  1. Enhanced -openmp option:

    The -openmp option flag has been enhanced to facilitate debugging OpenMP programs. To use dbx to debug your OpenMP application, compile with

    -openmp=noopt -g
    You will then be able to use dbx to breakpoint within parallel regions and display contents of variables.
  2. OpenMP support for explicit threading

    The implementation of the OpenMP API now supports user programs that are explicitly threaded.

  3. Multi-processor compilation:

    Specify -xjobs=n with -xipo and the interprocedural optimizer will invoke at most n code generator instances to compile the files listed on the command line. This option can greatly reduce the build time of large applications on a multi-cpu system.

  4. Making assertions with PRAGMA ASSUME:

    The ASSUME pragma is a new feature in this release of the compiler. This pragma gives the compiler hints about conditions the programmer knows are true at some point in a procedure. This can help the compiler to do a better job optimizing the code. The programmer can also use the assertions to check the validity of the program during execution. See the Fortran User's Guide for details.

  5. Fortran 2000 features:

    The following features appearing in the Fortran 2000 draft standard have been implemented in this release of Fortran 95 compiler, which can be found in PDF format at http://www.dkuug.dk/jtc1/sc22/open/n3501.pdf

    • Exceptions and IEEE Arithmetic:
      New intrinsic modules IEEE_ARITHMETIC, and IEEE_FEATURES provide support for exceptions and IEEE arithmetic in the Fortran language. Full support of these features is provided by:

      USE, INTRINSIC :: IEEE_ARITHMETIC
      USE, INTRINSIC :: IEEE_FEATURES

      These modules define a set of derived types, constants, rounding modes, inquiry functions, elemental functions, kind functions, and elemental and non-elemental subroutines. The details are contained in Chapter 14 of the draft standard for Fortran.


    • Interoperability with C:
      Another feature of the new draft standard for Fortran provides:

      • a means of referencing C language procedures and, conversely, a means of specifying that a Fortran subprogram can be referenced from a C function
      • a means of declaring global variables that are linked with external C variables

      The ISO_C_BINDING module provides access to named constants that are kind type parameters representing data that is compatible with C types.

      The draft standard also introduces the BIND(C) attribute. A Fortran derived type is interoperable with C if it has the BIND attribute.
      This release of the Fortran 95 compiler implements these features as described in the chapter 15 of the draft standard. Fortran also provides facilities for defining derived types, enumerations, and type aliases that correspond to C types, as described in Chapter 4 of the draft standard.


    • PROTECTED Attribute
      The Fortran 95 compiler now accepts the Fortran 2000 PROTECTED attribute. PROTECTED imposes limitations on the usage of module entities. Objects with the PROTECTED attribute are only definable within the module that declares them.


    • ASYNCHRONOUS I/O Specifier
      The compiler recognizes the ASYNCHRONOUS specifier on I/O statements:
             ASYNCHRONOUS=['YES' | 'NO']
      This syntax is as proposed in the draft standard, Chapter 9. In combination with the WAIT statement, it allows the programmer to specify I/O processes that may be overlapped with computation. While the compiler recognizes ASYNCHRONOUS='YES', the draft standard does not require actual asynchronous I/O. In this release of the compiler, I/O is always synchronous.


    • Fortran 2000 features already implemented:
      Three new formatted I/O specifiers were implemented in the previous release of f95. These are noted here.

      The new specifiers may appear on OPEN, READ, WRITE, PRINT, and INQUIRE statements:

      • DECIMAL=['POINT'|'COMMA']
        Change the default decimal editing mode. The default uses a period to separate the whole number and decimal parts of a floating-point number formatted with D, E, EN, ES, F, and G editing. DECIMAL='COMMA' changes the default to use a comma instead of a period (for example, 123,456 ).
        DECIMAL='POINT' sets the default back to using period (123.456).

        Note that with DECIMAL='COMMA' the separator for displaying COMPLEX data changes to a semicolon: (123,45;7,0)

      • ROUND=['PROCESSOR_DEFINED'|'COMPATIBLE']
        Set the default rounding mode for formatted I/O for D, E, EN, ES, F, and G editing. With ROUND='COMPATIBLE' , the value resulting from data conversion is the one closer to the two nearest representations, or the value away from zero if the value is halfway between them. With ROUND='PROCESSOR_DEFINED' , the rounding mode is dependent on the processor's default mode, and is the default if ROUND is not specified.

        As an example, consider WRITE(*,'(f11.4)') 0.11115
        This will print 0.1111 in default mode, and 0.1112 in COMPATIBLE mode.

        ROUND options 'UP', 'DOWN', 'ZERO', and 'NEAREST' have also been implemented.

      • IOMSG=character-variable
        Returns an error message as a string in the specified character variable. This is the same error message that would appear on standard output. Users should allocate a character buffer large enough to hold the longest message. CHARACTER *256 should be sufficient.

      Note that on an INQUIRE statement, these specifiers declare a character variable for returning the current values.

      Also, the edit descriptors DP, DC, RP, and RC change the defaults within a single format to decimal point, decimal comma, rounding processor-defined, and rounding compatible, respectively. For example:


      WRITE(*,'(I5, DC, F10.3)') N, W

      a comma will appear in the printed output from the F10.3 format instead of period.

      See also the -iorounding compiler option for changing floating point rounding modes. It is described in the f95 (1) man page.

  6. Enhanced compatibility with legacy f77:

    A number of new features enhance the Fortran 95 compiler's compatibility with legacy Fortran 77 compiler, f77. These include variable format expressions (VFE's), long identifiers, -arg=local , and the -vax compiler option.

    • Variable format expressions
      Fortran 77 allowed any integer constant in a format to be replaced by an arbitrary expression enclosed in angle brackets:
      1 FORMAT( … < e > … )
      Variable format expressions cannot appear as the n in an nH… edit descriptor, in a FORMAT statement that is referenced by an ASSIGN statement, or in a FORMAT statement within a parallel region.

      This feature is enabled natively in f95, and does not require the -f77 compatibility option flag.

    • Long identifiers
      f95 now allows identifier names to be up to 127 characters long.

    • -arg=local
      The f77 compiler option -arg=local is now supported by f95. This option preserves actual arguments over ENTRY statements. When you compile a subprogram with alternate entry points with this option, f95 uses copy restore to preserve the association of dummy and actual arguments. This option is provided for compatibility with legacy Fortran 77 programs. Code that relies on this option is non-standard.

    • VAX Fortran compatibility with -vax
      The f77 VAX VMS Fortran compatibility flag, -vax , is now supported by f95. Only these -vax sub-options are available:
      • -vax=struct_align
        Layout components of a VAX STRUCTURE in memory as in VAX FORTRAN, without padding. This option replaces the f77 -xl option. (Note: -vax=struct_align can cause data misalignment.)
      • -vax=debug
        Allow lines starting with the character 'D' to be compiled as a regular Fortran statement instead of as a comment line.
      • -vax=rsize
        Allow unformatted record sizes to be specified in words rather than in bytes.
      • -vax=blank_zero
        Interpret blanks in formatted input as zeros.

    • See the f95(1) man page for details.
  7. I/O error handlers:

    Two new functions enable the user to specify their own error handling routine for formatted input on a logical unit. When a formatting error is detected, the runtime I/O library calls the specified user-supplied handler routine with data pointing at the character in the input line causing the error. The handler routine can supply a new character and allow the I/O operation to continue at the point where the error was detected using the new character, or take the default Fortran error handling.

    The new routines, SET_IO_ERR_HANDLER(3f) and GET_IO_ERR_HANDLER (3f), are module subroutines and require USE SUN_IO_HANDLERS in the routine that calls them. See the man pages for these routines for details.

  8. Unsigned integers:

    With this release, the Fortran 95 compiler accepts a new data type, UNSIGNED, as an extension to the language. Four KIND parameter values are accepted with UNSIGNED: 1, 2, 4, and 8, corresponding to 1-, 2-, 4-, and 8-byte unsigned integers, respectively.

    The form of an unsigned integer constant is a digit-string followed by the upper or lower case letter U, optionally followed by an underscore and kind parameter. The following examples show the maximum values for unsigned integer constants:


    255u_1
    65535u_2
    4294967295U_4
    18446744073709551615U_8

    See the Fortran User's Guide for details.

  9. Preferred stack/heap page size:

    A new command-line option, -xpagesize, enables the running program to set the preferred stack and heap page size at program startup. For example, -xpagesize=4M sets the preferred Solaris 9 operating environment stack and heap page sizes to 4 megabytes. Choose from a set of preset values. Stack or heap page sizes can be set individually with -xpagesize_stack and -xpagesize_heap. (Note that this feature is not available on Solaris 7 and Solaris 8 environments. A program compiled with this flag will fail to link these environments.) See the f95 man page for details

  10. Faster profiling:

    This release introduces the new command-line option -xprofile_ircache= path, to speed up the "use" compilation phase during profile feedback. With this flag specified, the compiler saves intermediate data on path during the "collect" compilation phase, -xprofile=collect, for reuse later during the -xprofile=use phase, eliminating the need to regenerate this information. For large programs this could amount to a significant savings in compile time in the -xprofile=use phase.

  11. Enhanced "known libraries":

    The -xknown_lib option has been enhanced to include more routines from the Basic Linear Algebra Subprograms library, BLAS, and introduces three sub-options. The compiler recognizes calls to the following BLAS library routines and is free to optimize appropriately for the Sun Performance Library implementation.

    BLAS1 routines recognized by -xknown_lib=blas1:


    caxpy ccopy cdotc cdotu crotg
    cscal csrot csscal cswap dasum
    daxpy dcopy ddot drot
    drotg drotm drotmg dscal dsdot
    dswap dnrm2 dzasum dznrm2 icamax
    idamax isamax izamax sasum saxpy
    scasum scnrm2 scopy sdot sdsdot
    snrm2 srot srotg srotm srotmg
    sscal sswap zaxpy zcopy zdotc
    zdotu zdrot zdscal
    zrotg zscal zswap

    BLAS2 routines recognized by -xknown_lib=blas2:

    cgemv cgerc cgeru ctrmv ctrsv
    dgemv dger dsymv dsyr dsyr2
    dtrmv dtrsv sgemv sger
    ssymv ssyr ssyr2 strmv strsv
    zgemv zgerc zgeru ztrmv ztrsv

    BLAS3 routines recognized by -xknown_lib=blas3:

    cgemm csymm csyr2k csyrk ctrmm
    ctrsm dgemm dsymm dsyr2k dsyrk
    dtrmm dtrsm sgemm ssymm ssyr2k
    ssyrk strmm strsm zgemm zsymm
    zsyr2k zsyrk ztrmm ztrsm

    You can select any combination of these. For example -xknown_lib=blas2,blas3 selects just the BLAS2 and BLAS3 routines. You can select all the BLAS routines by specifying -xknown_lib=blas which is equivalent to -xknown_lib=blas1,blas2,blas3. The compiler will ignore user-supplied versions of these library routines and link to the BLAS routines in the Sun Performance Library. For more details, see the f95 man page.

  12. Link-time Optimization:

    Compile and link with the new -xlinkopt flag to invoke a post-optimizer to apply a number of advanced performance optimizations on the generated binary object code at link time.

    This option is most effective when used to compile the whole program with profile feedback. Profiling reveals the most and least used parts of the code and directs the optimizer to focus its effort accordingly. This is particularly important with large applications where optimal placement of code performed at link time can reduce instruction cache misses. For these codes, the performance improvement gained from link-time optimization could be significant.

    See the f95(1) man page for details on using this compiler option flag.

  13. Initialization of local variables :

    A new extension to the -xcheck option flag enables special initialization of local variables. Compiling with -xcheck=init_local initializes local variables to a value that is likely to cause an arithmetic exception if it is used before it is assigned by the program. Memory allocated by the ALLOCATE statement will also be initialized in this manner. SAVE variables, module variables, and variables in COMMON blocks are not initialized.


Forte Developer 6 update 2 Fortran 95 New Features

The Sun WorkShop 6 update 2 Fortran 95 compiler includes the following new and changed features.

  1. Sun WorkShop 6 update 2 New Features

    The Sun WorkShop 6 update 2 Fortran 95 includes the following new and changed features.

    1. ALLOCATABLE Attribute Extended
    2. VALUE Attribute from Fortran 2000
    3. OpenMP 2.0 Fortran API Supported
    4. OpenMP Library Interface
    5. Interprocedural Optimiization (-xipo)
    6. VAX Fortran Structures
    7. Stream I/O
    8. Global Program Checking
    9. Fortran Library Interface
    10. New and Changed -xtarget, -xchip Values


    1. ALLOCATABLE Attribute Extended Recent decisions by the Fortran 95 standards organizations have extended the data entities allowed for the ALLOCATABLE attribute. Previously this attribute was limited to locally stored array variables. It is now allowed on:
      • array components of structures
      • dummy arrays
      • array function results

      Allocatable entities remain forbidden in all places where they may be storage-associated (COMMON blocks and EQUIVALENCE statements). Allocatable array components may appear in SEQUENCE types, but objects of such types are then prohibited from COMMON and EQUIVALENCE. See the Fortran User's Guide appendix C.

    2. VALUE Attribute from Fortran 2000

      f95 recognizes the VALUE type declaration attribute. Specifying a subprogram dummy input argument with this attribute indicates that the actual argument is passed "by value". The following example demonstrates the use of the VALUE attribute with a C main program calling a Fortran 95 subprogram with a literal value as an argument:
       

      C code:
      #include <stdlib.h>
      int main(int ac, char *av[])
      {
      to_fortran(12);
      }

      Fortran code:
      subroutine to_fortran(i)
      integer, value :: i
      print *, i
      end


      See the Fortran User's Guide appendix C.

    3. OpenMP2.0 Fortran API Supported

      f95 now supports the OpenMP 2.0 API specifications for Fortran 95. Enhancements include WORKSHARE, REDUCTION for arrays, THREADPRIVATE for variables, COPYPRIVATE for SINGLE directives.

      See http://www.openmp.org/specs for the OpenMP 2.0 specifications. See also the OpenMP readme, and the Fortran User's Guide appendix E.

    4. OpenMP Library Interface

      The compiler now provides an include file and an interface module for defining the interfaces to the OpenMP Fortran library routines. Supply either of the following statements in every program unit that references the OpenMP library to insure proper type declarations:

       INCLUDE 'omp_lib.h'
      or
       USE omp_lib

      See the Fortran User's Guide appendix E.

    5. Interprocedural Optimization (-xipo)

      This new compiler flag performs whole-program optimizations by invoking an interprocedural analysis pass. Unlike -xcrossfile, -xipo will perform optimizations across all object files in the link step, and is not limited to just the source files on the compile command.

      -xipo is particularly useful when compiling and linking large multi-file applications. Object files compiled with this flag have analysis information compiled within them that enables interprocedural analysis across source and pre-compiled program files. However, analysis and optimization is limited to the object files compiled with -xipo, and does not extend to object files in libraries.

      When compiling and linking are performed in separate steps, -xipo must be specified in both steps to be effective.

      Example, in a single compile/link step:

      f95 -xipo -xO4 -o prog part1.f part2.f part3.f
      
      The optimizer performs crossfile inlining across all three source files. This is done in the final link step, so the compilation of the source files need not all take place in a single compilation and could be over a number of separate compilations, each specifying -xipo.

      Example, in separate compile/link steps:

      f95 -xipo -xO4 -c part1.f part2.f
      f95 -xipo -xO4 -c part3.f
      f95 -xipo -xO4 -o prog part1.o part2.o part3.o

      The object files created in the compile steps have additional analysis information compiled within them to permit crossfile optimizations to take place at the link step.

      A restriction is that libraries, even if compiled with -xipo do not participate in crossfile interprocedural analysis, as shown in this example:

      f95 -xipo -xO4 one.f two.f three.f
      ar -r mylib.a one.o two.o three.o
      ...
      f95 -xipo -xO4 -o myprog main.f four.f mylib.a

      Here interprocedural optimizations will be performed between one.f, two.f and three.f, and between main.f and four.f, but not between main.f or four.f and the routines on mylib.a. (The first compilation may generate warnings about undefined symbols, but the interprocedural optimizations will be performed because it is a compile and link step.)

      Other important information about -xipo:
       

      • requires at least optimization level -xO4.
      • conflicts with -xcrossfile. If used together will result in a compilation error.
      • objects compiled without -xipo can be linked freely with objects compiled with -xipo.

      In this release crossfile subprogram inlining is the only interprocedural optimization performed by -xipo. See the Fortran User's Guide chapter 3.

    6. VAX Fortran Structures

      To aid migration of programs from f77, f95 accepts VAX Fortran STRUCTURE and UNION statements, a precursor of Fortran 95 "derived types". See the Fortran User's Guide, appendix C.

    7. Stream I/O

      Another feature proposed for Fortran 2000 is a new "stream I/O" scheme, which treats a data file as a continuous sequence of bytes, addressable by a positive integer starting from 1. Enable stream I/O by declaring a file with ACCESS='STREAM'. Position files with READ or WRITE statements with the POS=integer_expression specifier. See the Fortran User's Guide, appendix C.

    8. Global Program Checking

      Invoked by the -Xlist options, GPC on f95 now looks more like f77, and includes suboptions -Xlistc -Xlisth -Xlists -Xlistvn and -Xlistw[n]. See the Fortran User's Guide, chapter 3.

    9. Fortran Library Interface

      f95 recognizes the include file system.inc for declaring the proper data types for the Fortran library. Supply the statement INCLUDE 'system.inc' in every routine that references non-intrinsic Fortran library routines to insure proper typing of return values. See the Fortran Library Reference.

    10. New and Changed Values for -xchip and -xtarget

      The -xchip option now accepts the value ultra2e for specifying the UltraSPARC IIe processor.

      Also, the implied -xarch setting for the following -xtarget values has changed from v8 to v8plusa:

      • entr2/1170
      • entr2/1200
      • entr2/2170
      • entr2/2200
      • entr3000
      • entr4000
      • entr5000
      • entr6000
      • ultra
      • ultra/140
      • ultra/170
      • ultra/200
      • ultra2
      • ultra2/1170
      • ultra2/1200
      • ultra2/1300
      • ultra2/2170
      • ultra2/2200
      • ultra2/2300
      • ultra2e
      • ultra2i
      • ultra3


  2. Sun WorkShop 6 update 1 New Features

    Sun WorkShop 6 update 1 Fortran 95 included the following new and changed features.

    1. UltraSPARC[tm] III Support
    2. Support for int2
    3. Mixed-Language Linking with -xlang
    4. Prefetch added to -fast

    1. UltraSPARC III Support

      The -xtarget and -xchip options now accept ultra3, and the compiler will generate optimized code for the UltraSPARC III processor.  Compile with the following flags when compiling and running on an UltraSPARC III platform: -fast -xcrossfile

      The -fast option automatically selects the proper options when running on an UltraSPARC III platform.

      For cross-compilation (compiling on a platform other than UltraSPARC III but generating binaries intended to run on an UltraSPARC III processor) , add:

            -xtarget=ultra3  -xarch={v8plusb|v9b}

      (Use -xarch=v9b to compile for 64-bit code generation.)

      Note that programs compiled specifically for the UltraSPARC III platform with -xarch={v8plusb|v9b} will not operate on platforms other than UltraSPARC III. Use -xarch={v8plusa/v9a} to compile programs to run compatibly on UltraSPARC I, II, and III.

      Performance profiling, -xprofile={collect:|use:}, is particularly useful on the UltraSPARC III platform by enabling the compiler to identify the most frequently executed sections of code and perform localized optimizations to best advantage.

    2. Support for the  int2 Intrinsic:

      The Fortran 95 (and Fortran 77) compilers now support the int2 intrinsic for conversion of data types to 2-byte integer. Use of int2 as an intrinsic ( M=int2(J) ) appears in many legacy Fortran 77 codes, and is implemented in the Fortran 95 compiler for compatibility. int  is the preferred  Fortran 95 standard intrinsic ( M=int(J,2)).

    3. Mixed-Language Linking with -xlang:

      The new -xlang option provides an easy way to link object files and libraries compiled by f77 with f95 object files. The proper runtime environment is insured when using -xlang.
      % f95 -o myprog -xlang=f77 myprog.o myf77sub.o
      When linking C++ and Fortran 95 and/or Fortran 77 object files, link with the C++ compiler and specify -xlang=f95. (See the C++ man page CC(1) for details.)

    4. Prefetch added to -fast:

      The -xprefetch flag has been added to the -fast  option set. -fast automatically sets a number of optimization flags for best execution speed on the compiling platform. Adding -xprefetch takes advantage of the UltraSPARC II and III prefetch mechanism, and can add a substantial performance gain in code with loops that process data.




Forte Developer 6 Fortran 95 New Features

This version of the Forte Developer Fortran 95 compiler includes the following new features:

  • Compliance: The Fortran 95 compiler is fully compliant with the Fortran 95 standard.

  •  
  • New Command: The Fortran 95 compiler is invoked by both the f90 and f95 command. The f95 command is new. f90 is equivalent to f95

  •  
  • File Extensions: The compiler will accept source files with .f95 and .F95 extensions as well as .f90 and .F90

  •  
  • Debugging Optimized Code: The restrictions on compiling with -g have been relaxed so that it is now possible to compile at -O4 and -O5 and/or any of the parallelization flags (-parallel, -explicitpar, -autopar) with debugging (-g).

  •  
  • F77 Flags: Most of the Fortran 77 compiler, f77, compiler flags are now implemented in f95/f90See the f95 man page for details. These include:
    • -erroff  turn off selected error messages
    • -errtags  display error messages with tags
    • -ext_names  create external names with/without underscores
    • -fpp       specify source code preprocessor
    • -loopinfo   show which loops parallelized
    • -sbfast  produce browser table information
    • -silent  suppress compiler messages
    • -U   allow lower and upper case
    • -u   imply IMPLICIT NONE
    • -xcrossfile  enable optimization across files
    • -xF  allow function-level reordering for Analyzer
    • -xinline   compile functions inline
    • -xtypemap  specify default data sizes
    • -xprefetch   allows automatic and explicit generation of prefetch instructions on UltraSPARC platforms (-xprefetch=explicit enables new $PRAGMA SPARC_PREFETCH directives).
  • New Flags: The following new flags are implemented in f95/f90 :
    • -aligncommon    align common block elements to specified byte boundaries
    • -mp=openmp      accept OpenMP directives
    • -openmp              macro combination of options for OpenMP parallelization
    • -r8const                promote single-precision constants to REAL*8
    • -xia           enable interval arithmetic environment
    • -xinterval    enable processing of interval arithmetic extensions
    • -xmemalign   specify general alignment of data elements
    • -xrecursive    allow recursive calls without RECURSIVE attribute
  • OpenMP:  This release of Fortran 95 implements the OpenMP interface for explicit parallelization, including a set of source code directives, run-time library routines, and environment variables. Preliminary documentation is available in an OpenMP README. The OpenMP specifications can be viewed at http://www.openmp.org/  (Parallelization features require a Sun WorkShop HPC license.)

  •  
  • Interval Arithmetic Extensions: This release of Fortran 95 also implements extensions for interval arithmetic computation. See the Fortran 95 Interval Arithmetic Programming Guide,  and the README file "interval_arithmetic.html."

  •  
  • FORM="BINARY" I/O Extension: Specifying this new option in an OPEN(..) statement causes the file to be treated as a sequential binary (unformatted) file with no record marks. This enables data to be written and read as a continuous stream of bytes, and provides compatibility with other vendor systems. It is implemented in both the Fortran 95 (f95/f90) and Fortran 77 (f77) compilers.

  •  Effect of FORM="BINARY" on I/O operations: 
  • WRITE statement: Data is written to the file in binary, with as many bytes transferred as there is specified in the output list.
  • READ statement: Data is read into the variables on the input list, with as many bytes transferred as demanded by the list. Because there are no record marks on the file, there will be no "end-of-record" error detection. The only error detected is end-of-file, or abnormal system errors.
  • INQUIRE statement: INQUIRE on a file opened with FORM="BINARY" returns:
  • FORM="BINARY"
    ACCESS="SEQUENTIAL"
    SEQUENTIAL="YES"
    DIRECT="NO"
    FORMATTED="NO"
    UNFORMATTED="YES"
    RECL= and NEXTREC= are undefined.
  • BACKSPACE statement: Not allowed - returns an error.
  • ENDFILE statement: Truncates file at current position, as usual.
  • REWIND statement: Repositions file to beginning of data, as usual.
  • Cray-Style Parallelization Directives:  The AUTOSCOPE qualifier has been implemented with Cray-style directives.

  •  
  • Enhanced Array Optimization: The compiler performs aggressive array optimizations at levels -O4 and -O5. Please report any problems you may encounter. Note that these optimizations can be turned off by specifying  -qoption f90comp -fenophoenix

  •  
  • Sun WorkShop online help now interprets f95 error diagnostics in the Building window. Like C compiler error diagnostics, these f95 error messages have hyperlinks to help pages that explain the diagnostic message.