-qstrict_induction

Category

Optimization and tuning

@PROCESS

None.

Purpose

Prevents the compiler from performing induction (loop counter) variable optimizations. These optimizations may be unsafe (may alter the semantics of your program) when there are integer overflow operations involving the induction variables.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-nostrict_induction-.   
>>- -q--+-strict_induction---+---------------------------------><

Defaults

-qnostrict_induction

Usage

You should avoid specifying -qstrict_induction unless absolutely necessary, as it may cause performance degradation.

Examples

Consider the following two examples:

Example 1
    integer(1) :: i, j                 ! Variable i can hold a
    j = 0                              ! maximum value of 127.

    do i = 1, 200                      ! Integer overflow occurs when 128th
      j = j + 1                        ! iteration of loop is attempted.
    enddo
Example 2
    integer(1) :: i
    i = 1_1                            ! Variable i can hold a maximum
                                       ! value of 127.
100 continue
    if (i == -127) goto 200            ! Go to label 200 once decimal overflow
      i = i + 1_1                      ! occurs and i == -127.
      goto 100
200 continue
    print *, i
    end

If you compile these examples with the -qstrict_induction option, the compiler does not perform induction variable optimizations, but the performance of the code may be affected. If you compile the examples with the -qnostrict_induction option, the compiler may perform optimizations that may alter the semantics of the programs.

Related information