XL Fortran for AIX 8.1

User's Guide


Avoiding or Fixing Upgrade Problems

Although XL Fortran is generally backward-compatible with FORTRAN 77 programs, there are some changes in XL Fortran and the Fortran 90 and Fortran 95 languages that you should be aware of.

To preserve the behavior of existing compilation environments, the xlf, and f77 commands both work as they did in earlier XL Fortran versions wherever possible. As you write entirely new Fortran 90 or Fortran 95 programs or adapt old programs to avoid potential problems, you can begin using the xlf90 and xlf95 commands, which use Fortran 90 and Fortran 95 conventions for source-code format.

Note that in the following table, you can substitute xlf_r or xlf_r7 for xlf, xlf90_r or xlf90_r7 for xlf90, and xlf95_r or xlf95_r7 for xlf95.

Table 1. Potential Problems Migrating Programs to XL Fortran Version 8

The column on the right shows which problems you can avoid by using the xlf or f77 command.
Potential Problem Solution or Workaround xlf Avoids?
Compilation Problems
New intrinsic procedure names may conflict with external procedure names. The intrinsic procedure is called instead of the external procedure. Use the -qextern option, or insert EXTERNAL statements to avoid the ambiguity. Consider switching to the Fortran 90 or Fortran 95 procedure if it does what you want.
The .XOR. intrinsic is not recognized. Use the option -qxlf77=intxor. Yes
Zero-sized objects are not allowed by the compiler. Use the xlf90 or xlf95 command, or use the -qzerosize option with the xlf or f77 command.
Performance / Optimization Problems
Existing programs or programs linked with older XL Fortran object files run more slowly or do not show expected performance improvements on new hardware. Recompile everything.
Programs compiled with -O3 or -qhot optimization behave differently from those unoptimized (different results, exceptions, or compilation messages). Try adding the -qstrict option.
The option combination -O and -1 cannot be abbreviated -O1, to avoid misunderstandings. (There are -O2, -O3, -O4, and -O5 optimization levels, but there is no -O1.) Specify -O and -1 as separate options.
Programs that use integer POINTERs produce incorrect results when optimized. Specify the option -qalias=intptr with the xlf90 or xlf95 command, or use the xlf command. Yes
Run-Time Problems
Programs that read to the end of the file and then try to append records without first executing a BACKSPACE statement do not work correctly. The write requests generate error messages. To compile existing programs, specify the option -qxlf77=softeof with the xlf90 or xlf95 command, or use the xlf command. For new programs, add the BACKSPACE statement before writing past the endfile record. Yes
Uninitialized variables are not necessarily set to zero, and programs that ran before may exceed the user stack limit. The reason is that the default storage class is now AUTOMATIC, rather than STATIC (an implementation choice allowed by the language). Ensure that you explicitly initialize your variables, use the -qsave option with the xlf90 or xlf95 command, or add SAVE statements where needed in the source. Yes
Writing data to some files opened without a POSITION= specifier overwrites the files, instead of appending the data. Use the option -qposition=appendold, or add POSITION= specifiers where needed. Yes
Newly compiled programs are unable to read existing data files containing NAMELIST data. The reason is that the Fortran 90 and Fortran 95 standards define a namelist format that is different from that used on AIX in the past. Set the environment variable XLFRTEOPTS to the string namelist=old.

The programs that produced the old NAMELIST data must be recompiled.


Some I/O statements and edit descriptors accept or produce slightly different input and output. For example, real output now has a leading zero when appropriate.

The changes to I/O formats are intended to be more usable and typical of industry practice, so you should try to use the defaults for any new data you produce.

When you need to maintain compatibility with existing data files, compile with the xlf command. If the incompatibility is due to a single specific I/O change, see if the -qxlf77 option has a suboption for backward compatibility. If so, you can switch to the xlf90 or xlf95 command and use the -qxlf77 option on programs that use the old data files. Yes
Numeric results and I/O output are not always exactly identical with XL Fortran Version 2. Certain implementation details of I/O, such as spacing in list-directed output and the meanings of some IOSTAT values, have changed since XL Fortran Version 2. (This entry is similar to the previous one except that these differences have no backward-compatibility switches.) You may need to generate existing data files again or to change any programs that depend on these details. When no backward-compatibility switch is provided by the -qxlf77 compiler option or XLFRTEOPTS run-time options, there is no way to get the old behavior back.
SIGN(A,B) now returns -|A| when B=-0.0. Prior to XL Fortran Version 7.1, it returned |A|. This behavior conforms with the Fortran 95 standard and is consistent with the IEEE standard for binary floating-point arithmetic. It occurs because the -qxlf90=signedzero option is turned on. Turn it off, or specify a command that does not use this option by default. Yes
A minus sign is printed for a negative zero in formatted output. A minus sign is printed for negative values that have an outputted form of zero (that is, in the case where trailing non-zero digits are truncated from the output so that the resulting output looks like zero). Prior to XL Fortran Version 7.1, minus signs were not printed in these situations. This behavior conforms with the Fortran 95 standard and occurs because the -qxlf90=signedzero option is turned on. Turn it off, or specify a command that does not use this option by default. Yes
Related Information:

Running Two Levels of XL Fortran

It is possible for two different levels of the XL Fortran compiler to exist on one system. This allows you to invoke one level by default and to invoke the other one whenever you explicitly choose to.

To do this, consult the Memo to Users for details.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]