Skip to main content

SA0180: Index range does not cover the whole array

Detects arrays with incompletely covered index range

Arrays are often handled in loops, where the loop index indexes the array so that all components of the array are jumped to without gaps. This is given if the loop index and the array index are the same in all dimensions. If the index range does not completely cover the array, then this indicates unhandled components in the array.

Importance: Medium

Example 131. Example
{attribute 'do-analysis'}
PROGRAM PLC_PRG
VAR
    a : INT;
    arWord : ARRAY [0..100] OF WORD;
END_VAR
//Implementation
FOR a := INT#1 TO INT#100 BY 1 DO //SA0180: Lower range is not reached
	arWord[a] := INT_TO_WORD(a);
END_FOR;
;

Output in the Messages view:

  • sa_icon_message.png SA0180: Index range doesn't cover the whole array