Detects arrays with only one element
Justification: An array with one element can be replaced by a base-type variable. Access to this variable is considerably faster than access by index to the variable.
Exception: The length of an array is often determined by a constant and is a parameter for a program. Then the program can work with arrays of different lengths and does not have to be changed if the length is only 1. This kind of situation should be documented accordingly.
Importance: Low
Example
PROGRAM PLC_PRG VAR aoiEmpty : ARRAY [22..22] OF INT; aorEmpty : ARRAY [1..1] OF REAL; END_VAR aoiEmpty; aorEmpty; --> SA0010: Vacuous array element in variable 'aoiEmpty' --> SA0010: Vacuous array element in variable 'aorEmpty'