SA0018: Unusual bit access
Detects bit access to signed variables. However, the IEC 61131-3 standard permits only bit access and bit shift operations on bit fields.
See also the strict rules SA0147 and SA0148.
Justification: Signed data types should not be used as bit fields and the other way around. The IEC 61131-3 standard does not provide for this kind of access, and therefore you should comply with this rule when you write portable code.
Importance: Medium
Tip
Exception for flag enumerations: When an enumeration is declared as a flag by means of the {attribute 'flags'} pragma attribute, the SA0018 error is not issued for bit access with the OR, AND or NOT operators.
PROGRAM PLC_PRG
VAR
    iTemp1 : INT;
    diTemp3 : DINT;
    uliTemp4 : ULINT;
    siTemp5 : SINT;
    usiTemp6 : USINT;
    byTemp2 : BYTE;
END_VAR
iTemp1.3 := TRUE; //SA0018 diTemp3.4 := TRUE; //SA0018 uliTemp4.18 := FALSE; //no error because this is an unsigned data type siTemp5.2 := FALSE; //SA0018 usiTemp6.3 := TRUE; //no error because this is an unsigned data type byTemp2.5 := FALSE; //no error because the byte is a bitfield
Output in the Messages view:
 SA0018: Unusual bit access