iec-checker icon indicating copy to clipboard operation
iec-checker copied to clipboard

False positive: PLCOpen CP1

Open jubnzv opened this issue 2 years ago • 0 comments

The following snippet raises false positive for CP1:

PROGRAM l10
  VAR
  END_VAR

   %MW10.2.4.1 := 42; (* False positive PLCOPEN-CP1 *)
END_PROGRAM

Actually, this warning should be reported only when accessing a direct located struct member, as it is specified in the example from the PLCOpen document:

STRUCT EXAMPLE_STRUCT
X : DINT
Y : BOOL;
Z : STRING[40];
END_STRUCT;
VAR
instance : EXAMPLE_STRUCT AT %MW500;
END_VAR
// Write the first character of Z:
%MW504 := 'E';

jubnzv avatar Oct 26 '22 00:10 jubnzv