Parallel Programming Guide for HP-UX Systems

Troubleshooting
Compiler assumptions
Chapter 9 201
ENDDO
PRINT *, A(1)
PRINT *, B(11)
END
Because IZR is an argument passed to SUB1, the compiler does not detect
that IZR has been set to zero. Both loops parallelize at
+O3 +Oparallel +Onodynsel.
The loops compile at +O3, but the first loop, which specifies the step as
part of the DO statement (or as part of the for statement in C), attempts
to parcel out loop iterations by a step of IZR. At runtime, this loop is
infinite.
Due to dependences, the second loop would not behave predictably when
parallelized—if it were ever reached at runtime. The compiler does not
detect the dependences because it assumes J is an induction variable.
NOTE In HP Fortran 3.2 and higher versions, the +Oparallel
option is not supported on Integrity systems. You must use
+Oautopar instead of +Oparallel for Fortran applications
on Integrity systems.
Trip counts that may overflow
Some loop optimizations at +O2 and above may cause the variable on
which the trip count is based to overflow. A loop’s trip count is the
number of times the loop executes. The compiler assumes that each
induction variable is increasing (or decreasing) without overflow during
the loop. Any overflowing induction variable may be used by the compiler
as a basis for the trip count. The following sections discuss when this
overflow may occur and how to avoid it.
Linear test replacement
When optimizing loops, the compiler often disregards the original
induction variable, using instead a variable or value that better indicates
the actual stride of the loop. A loop’s stride is the value by which the
iteration variable increases on each iteration. By picking the largest
possible stride, the compiler reduces the execution time of the loop by
reducing the number of arithmetic operations within each iteration.