We're trying to summarize the benefit of using the BLOCK construct that is introduced by the Fortran 2008 standard. However, we finally draw a conclusion that the BLOCK construct is useful in very large programs, because in small programs, variables are much easier to keep track of.

Nevertheless, we would like to use the following small programs to illustrate the benefits.

The BLOCK construct improves the readability of code by allowing you to declare variables closer to where they are used in the code. In the following program, BLOCK constructs are used in the SELECT TYPE choices.

When compiling with compiler invocations conforming to earlier Fortran standards, you can specify -qxlf2008=checkpresence to check the dummy argument presence according to the Fortran 2008 standard .
The default for the f2008, xlf2008, and xlf2008_r commands is checkpresence, and if you decide that dummy argument presence should be checked according to previous Fortran standards, specify -qxlf2008=nocheckpresence.

The difference is as follows.
According to Fortran 2008 standard, a dummy argument or an entity that is host associated with a dummy argument is absent under one of these conditions:

It does not have the ALLOCATABLE attribute, and corresponds to an actual argument that has the ALLOCATABLE attribute but is not allocated.

It does not have the POINTER attribute, and corresponds to an actual argument that has the POINTER attribute but is not associated.

However, there are also exceptions according to Fortran 2008 standard. Dummy argument is regarded as present when it is optional under the following conditions:

A procedure pointer actual argument is supplied to an optional dummy procedure argument.

A pointer or allocatable actual argument is supplied to an optional dummy argument of an intrinsic procedure.

A pointer or allocatable actual argument is supplied to an optional dummy argument of an elemental procedure.

Using uninitialized variables might cause program errors. XL Fortran has already provided the -qinitauto option to help users identify uninitialized automatic variables during debugging by initializing them to a specific value. Note that XL Fortran for AIX and Linux, V14.1 provides the enhancement, the -qinitalloc option, to handle uninitialized variables with the ALLOCATABLE or POINTER attributes that are allocated using the ALLOCATE statement.

As to the working pattern, the -qinitalloc option is similar to the -qinitauto option, and it is easier to understand if you are familiar with the -qinitauto option. Here are some highlights:

The compiler does not initialize allocated storage to any particular value by default. To enable it, you can specify -qinitalloc=hex_value (a one- to eight-digit hexadecimal number) during compilation.

If you do not specify a hex_value, the compiler initializes the value of each byte of allocated storage to zero, which ensures that all allocatable variables are cleared before being used.

Of course, you can provide a signaling or quiet not-a-number (NaN) for easier recognition. A signaling NaN causes an invalid operation exception whenever it appears as an operand. Although a quiet NaN does not signal an exception, it will propagate a NaN result through subsequent computation.

For derived type variables with default initialization, initialization with hex_value occurs before the default initialization, which means the default initialization overrides the -qinitalloc option.

For detailed rules about the option parameter, hex_value, and examples, see information center.

In the above example, the declaration of type point_2003 conforms to Fortran 2003 and above. It is accepted by Fortran 2003 compilers, such as XL Fortran 13.1, as well as Fortran 2008 compilers. The declaration of type point_2008, on the other hand, conforms to Fortran 2008, and is only accepted by XL Fortran 14.1 and above.

The POPCNT intrinsic function is new for XL Fortran V14.1. It counts the number of set bits in a data object. The data object can be of type integer, byte, logical, or real with REAL(16) excluded.

The result value is the number of bits set to 1 in the sequence of bits of the given data object. For example, the binary representation for decimal number 4 is 0100, so the value of POPCNT(4) is 1. Similarly, the binary representation for decimal number 3 is 0011, so the value of POPCNT(3) is 2.

Starting with this release, fixed APARs will be listed on a separate 'Fix list' webpage which will contain lists of all APARs fixed and PTFs published since the product GA. Please note that the term 'Fix Pack' is equivalent to 'PTF', and both terms may be used interchangeably. For more information on VRMF product release terminology, please review this technote.

The Fortran 2008 standard has the following exception to argument presence:

A dummy argument or an entity that is host associated with a dummy argument is not present if the dummy argument does not have the ALLOCATABLE or POINTER attribute, and corresponds to an actual argument that has the ALLOCATABLE attribute and is not allocated, or has the POINTER attribute and is disassociated.

In XL Fortran, V14.1, the -qxlf2008=checkpresence option is added so users can detect actual argument presence correctly. The default of the option depends on your invocation command:

If you specify the f2008, xlf2008, or xlf2008_r command, the default is -qxlf2008=checkpresence. When -qxlf2008=checkpresence is in effect, dummy argument presence is checked according to the Fortran 2008 standard.

If you specify other invocation commands, the default is -qxlf2008=nocheckpresence. When -qxlf2008=nocheckpresence is in effect, dummy argument presence is checked according to previous Fortran standards.

When -qxlf2008=checkpresence is in effect, the performance of your program is inhibited because of runtime checks for the allocation and association status of actual arguments. To avoid these performance impacts, consider using -qxlf2008=nocheckpresence.

The STOP statement has been enhanced in XL Fortran v14.1 to comply with the F2008 standard. The stop code can now be specified using any scalar integer constant expression or a scalar character constant expression. For instance, you can now successfully compile and run the following short program:

INTEGER, PARAMETER :: rc = 2
STOP rc
END

The same program would have been invalid in previous standards, since the error code is not a string of 1 to 5 digits.

The ERROR STOP statement is new in XL Fortran V14.1. It has similar function and syntax as the STOP statement. While the STOP statement initiates normal termination of a program, the ERROR STOP statement initiates error termination. Also, when stop code is not specified, the system return code is:

0 when a STOP statement is executed.

1 when an ERROR STOP statement is executed.

Proper usage of the statement can help you distinguish the stop caused by error. For details and examples, please refer to the information center.

Please Note: Starting March 2013, all XL compiler PTFs will be made available through Fix Central only, and will require an IBM ID. Fix Central offers three download methods: Download Director, Bulk FTP, and HTTP.

The first enhancement has to do with the SOURCE= specifier. In Fortran 2003, you are not allowed to omit the bounds information when allocating an array in the ALLOCATE statement. In Fortran 2008, when you use an ALLOCATE statement without specifying the bounds for an array, the bounds of source_expr in the SOURCE= specifier determine the bounds of the array.

The second enhancement is the addition of the MOLD= specifier. The MOLD= specifier works almost in the same way as SOURCE=. Like SOURCE=, MOLD= causes the object to be allocated to have the same type and type parameters as the source_expr specified in the MOLD= specifier. Similarly, if you don't specify the bounds for an array in the ALLOCATE statement, the bounds of source_expr in the MOLD= specifier determine the bounds of the array. Unlike SOURCE=, MOLD= does not copy the value of source_expr to the variable to be allocated. Because no copying takes place, if source_expr in MOLD= is a variable, its value need not be defined.

In the same ALLOCATE statement, you can specify only one of SOURCE= or MOLD=.

Please Note: Starting March 2013, all XL compiler PTFs will be made available through Fix Central only, and will require an IBM ID. Fix Central offers three download methods: Download Director, Bulk FTP, and HTTP.

XL Fortran supports implied-shape arrays. An implied-shape array is a named constant that inherits its shape from the constant expression in its declaration.

In the following example, array imp is an implied-shape array. Its declaration contains an implied-shape specification and a constant expression which is an array. Array imp is a rank-one array and its upper bound is 2.

We were required to type FUNCTION
or SUBROUTINE together with the END keyword to indicate the end of an internal
subprogram or module subprogram. But with this new feature, we can omit
FUNCTION and SUBROUTINE in such scope and only use the END keyword. It saves
efforts of writing complete END statement. In addition, if we choose to omit FUNCTION or SUBROUTINE and stay
concise, the name of the function or subroutine should also be omitted.

If you are
interested in the
feature, you can follow the link
to
learn more.

In the past, the intrinsic procedures REAL(z) and AIMAG(z) (where z is of type complex) were used to get the real part and imaginary part of z. For example,

COMPLEX :: z = (3.2, 2.1)

REAL(z) has the value 3.2. AIMAG(z) has the value 2.1.

In Fortran 2008, you can use the complex part designators with the %RE and %IM selectors instead; that is,

z % RE has the value 3.2.z % IM has the value 2.1.

You might benefit from the direct access to the real or imaginary part of complex entities by using the complex part designators as variables in assignment statements; typically when you want to directly set the real or imaginary part of a complex variable to a specific value. For example,

Please Note: This is the last PTF download for XL Fortran for AIX, V13.1 available via direct FTP link. All subsequent PTFs after February 2013 will be made available through Fix Central only, and will require an IBM ID. Fix Central offers three download methods: Download Director, Bulk FTP, and HTTP.