jubnzv / iec-checker

Static analysis of IEC 61131-3 programs
GNU Lesser General Public License v3.0
60 stars 12 forks source link

PLCOpen N1: Avoid physical addresses #15

Open jubnzv opened 1 year ago

jubnzv commented 1 year ago

The use of hardcoded physical addresses should be avoided.

So, we have to report any physical address in the code, except those that are used when initializing variables:

PROGRAM l10
  VAR
    a AT %MW10.2.4.1 : INT;
  END_VAR

   %MW10.2.4.1 := 42; (* PLCOPEN-N1 *)
   a := 42; (* ok *)
END_PROGRAM

This could be implemented as a simple pass on AST.