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.

-qstrict_induction Option<br />

Syntax<br />

-qSTRICT_INDUCtion | -qNOSTRICT_INDUCtion<br />

Prevents the compiler from per<strong>for</strong>ming induction (loop counter) variable<br />

optimizations. These optimizations may be unsafe (may alter the semantics of your<br />

program) when there are integer overflow operations involving the induction<br />

variables.<br />

You should avoid specifying -qstrict_induction unless absolutely necessary, as it<br />

may cause per<strong>for</strong>mance degradation.<br />

Examples<br />

Consider the following two examples:<br />

Example 1<br />

integer(1) :: i, j<br />

! Variable i can hold a<br />

j = 0 ! maximum value of 127.<br />

do i = 1, 200<br />

j = j + 1<br />

enddo<br />

! Integer overflow occurs when 128th<br />

! iteration of loop is attempted.<br />

Example 2<br />

integer(1) :: i<br />

i = 1_1<br />

! Variable i can hold a maximum<br />

! value of 127.<br />

100 continue<br />

if (i == -127) goto 200<br />

i = i + 1_1 ! occurs and i == -127.<br />

goto 100<br />

200 continue<br />

print *, i<br />

end<br />

! Go to label 200 once decimal overflow<br />

If you compile these examples with the -qstrict_induction option, the compiler<br />

does not per<strong>for</strong>m induction variable optimizations, but the per<strong>for</strong>mance of the<br />

code may be affected. If you compile the examples with the -qnostrict_induction<br />

option, the compiler may per<strong>for</strong>m optimizations that may alter the semantics of the<br />

programs.<br />

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

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

Saved successfully!

Ooh no, something went wrong!