The C*$* assert bounds violations
assertion indicates
that array subscript bounds may be violated during execution. If the
user has not violated array subscript bounds, this assertion should
not be used. A bounds violations assertion is active until reset or
until the end of the program. For formal parameters, KAP treats a
declared last dimension of (1) the same as (*).
The /assume=b
command qualifier acts like a global
C*$* assert
bounds violations assertion.
In the following example, the first loop nest is assumed to be
standard-conforming, so the loops can both be optimized. The
loops can be interchanged to improve memory referencing, since no
A(I,J)
will overwrite an A(I',J+1)
. In
the second nest, the assertion warns KAP that the loop limit of the
first array index (I)
may violate the declared array
bounds. KAP is cautious and optimizes only the right array index.
DO 100 I = 1,M DO 100 J = 1,N A(I,J) = A(I,J) + B (I,J) 100 CONTINUE C C*$*ASSERT BOUNDS VIOLATIONS DO 200 I = 1,M DO 200 J = 1,N A(I,J) = A(I,J) + B (I,J) 200 CONTINUE
Becomes:
DO 2 J=1,N DO 2 I=1,M A(I,J) = A(I,J) + B (I,J) 2 CONTINUE C C*$* ASSERTBOUNDSVIOLATIONS DO 4 I=1,M DO 3 J=1,N A(I,J) = A(I,J) + B (I,J) 3 CONTINUE 4 CONTINUE