Detects the lines of code where two or more variables reserve the same memory.
Justification: When two variables reserve the same memory, the code may behave with unexpected results. This situation should be avoided at all costs. If you cannot avoid using a value in different interpretations (for example, one time as DINT
and another time as REAL
), then you should define a UNION
. You can also use a pointer to access a value with a different type without the value being converted.
Importance: High
Example
PROGRAM PLC_PRG
VAR
iVvar1 AT %QB21: INT;
dwVar2 AT %QD5: DWORD;
END_VAR
--> Die folgenden Variablen greifen auf denselben Speicher zu:
--> SA0028: iVar1 AT %QB21
--> SA0028: dwVar2 AT %QD5
See also