Skip to main content

Compiler Warning C0572

Message: The uninitialized variable <variable1> is used for initialization of <variable2>. Use the 'global_init_slot' attribute to change the order of initialisation.

Possible error cause: In the case of nested structures, warning C0572 is issued instead of error C0268 when an uninitialized variable exists in an inner structure.

Example 503. Example of the warning
GVL
{attribute 'qualified_only'}
VAR_GLOBAL
      x : INT := 7;
      y : INT := 9;
END_VAR

TYPE DUT :
STRUCT
      a : INT;
      i : INT := GVL.x;
END_STRUCT
END_TYPE

TYPE DUT_1 :
STRUCT
      d : DUT;
END_STRUCT
END_TYPE

PROGRAM PLC_PRG
VAR CONSTANT