9.3.4 Zero-Trip IF Removal

DO loops in Fortran 77 are not executed if the initial value of the DO control variable is beyond the final value. These are called zero-trip loops. IF statements can be removed when they are used only to ensure that a DO statement is executed only when the upper bound of the loop is greater than or equal to the lower bound. For example:

IF (N .GE. 1) THEN
DO 10 I = 1,N
A(I) = A(I-1) + B(I)
10   CONTINUE
ENDIF

Becomes:

DO 10 II1=1,N
A(II1) = A(II1-1) + B(II1)
10    CONTINUE


Previous Page | Next Page | Contents | Index |
Command-Line Qualifiers

Copyright © Digital Equipment Corporation. 1999. All Rights Reserved.