24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

-qinitauto Option<br />

Syntax<br />

-qinitauto[=hex_value] | -qnoinitauto<br />

Initializes each byte or word (4 bytes) of storage <strong>for</strong> automatic variables to a<br />

specific value, depending on the length of the hex_value. This helps you to locate<br />

variables that are referenced be<strong>for</strong>e being defined. For example, by using both the<br />

-qinitauto option to initialize REAL variables with a NaNS value and the -qflttrap<br />

option, it is possible to identify references to uninitialized REAL variables at run<br />

time. Prior to <strong>XL</strong> <strong>Fortran</strong> Version 5.1.1, you could only use this option to initialize<br />

each byte of storage.<br />

Setting hex_value to zero ensures that all automatic variables are cleared be<strong>for</strong>e<br />

being used. Some programs assume that variables are initialized to zero and do not<br />

work when they are not. Other programs may work if they are not optimized but<br />

fail when they are optimized. Typically, setting all the variables to all zero bytes<br />

prevents such run-time errors. It is better to locate the variables that require<br />

zeroing and insert code in your program to do so than to rely on this option to do<br />

it <strong>for</strong> you. Using this option will generally zero more things than necessary and<br />

may result in slower programs.<br />

To locate and fix these errors, set the bytes to a value other than zero, which will<br />

consistently reproduce incorrect results. This method is especially valuable in cases<br />

where adding debugging statements or loading the program into a symbolic<br />

debugger makes the error go away.<br />

Setting hex_value to FF (255) gives REAL and COMPLEX variables an initial value<br />

of “negative not a number”, or -NaNQ. Any operations on these variables will also<br />

result in NaNQ values, making it clear that an uninitialized variable has been used<br />

in a calculation.<br />

This option can help you to debug programs with uninitialized variables in<br />

subprograms; <strong>for</strong> example, you can use it to initialize REAL variables with a NaNS<br />

value. You can initialize 8-byte REAL variables to double-precision NaNS values<br />

by specifying an 8-digit hexadecimal number, that, when repeated, has a<br />

double-precision NaNS value. For example, you could specify a number such as<br />

7FBFFFFF, that, when stored in a REAL(4) variable, has a single-precision NaNS<br />

value. The value 7FF7FFFF, when stored in a REAL(4) variable, has a<br />

single-precision NaNQ value. If the same number is stored twice in a REAL(8)<br />

variable (7FF7FFFF7FF7FFFF), it has a double-precision NaNS value.<br />

Arguments<br />

v The hex_value is a 1-digit to 8-digit hexadecimal (0-F) number.<br />

v<br />

v<br />

To initialize each byte of storage to a specific value, specify 1 or 2 digits <strong>for</strong> the<br />

hex_value. If you specify only 1 digit, the compiler pads the hex_value on the left<br />

with a zero.<br />

To initialize each word of storage to a specific value, specify 3 to 8 digits <strong>for</strong> the<br />

hex_value. If you specify more than 2 but fewer than 8 digits, the compiler pads<br />

the hex_value on the left with zeros.<br />

v In the case of word initialization, if automatic variables are not a multiple of 4<br />

bytes in length, the hex_value may be truncated on the left to fit. For example, if<br />

you specify 5 digits <strong>for</strong> the hex_value and an automatic variable is only 1 byte<br />

long, the compiler truncates the 3 digits on the left-hand side of the hex_value<br />

and assigns the two right-hand digits to the variable.<br />

<strong>XL</strong> <strong>Fortran</strong> Compiler-Option Reference 177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!