SA0172: Possible attempt to access outside the array limits

Function

Determines possible accesses to an array index outside the array limits.

Reason

The range of the array index is often exceeded in FOR loops in which the index variable is used to access an array index.

Importance

High

Sample:

PROGRAM MAIN 
VAR_TEMP
    nIndex       : INT;
END_VAR
VAR
    aSample      : ARRAY[0..10] OF INT;
END_VAR
FOR nIndex := INT#0 TO INT#50 DO
    aSample[nIndex] := 0;                      // => SA0172
END_FOR