[Beremiz-devel] Complex retain data compilation bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Beremiz-devel] Complex retain data compilation bug

Beremiz-Devel mailing list
Hello!

I figured out that there is some problems with retain structures. I try to compile the follows:

TYPE
  datatype0 : STRUCT
    a : REAL;
    b : DINT;
  END_STRUCT;
END_TYPE

PROGRAM program0
  VAR RETAIN
    SimpleRetain : REAL;
    ComplexRetain : datatype0;
  END_VAR
  VAR
    rez : INT;
    firstTime : BOOL := TRUE;
  END_VAR

  if firstTime then
    firstTime := FALSE;
    rez := SET_HOLDING_REAL(0, SimpleRetain);
    rez := SET_HOLDING_REAL(2, ComplexRetain.a);
  else
    SimpleRetain := GET_HOLDING_REAL(0);
    ComplexRetain.a := GET_HOLDING_REAL(2);

  end_if;
END_PROGRAM

After compilation a got the follows init function in POU.c:

void PROGRAM0_init__(PROGRAM0 *data__, BOOL retain) {
  __INIT_VAR(data__->SIMPLERETAIN,0,1)
  {
    static const DATATYPE0 temp = {0,0};
    __SET_VAR(data__->,COMPLEXRETAIN,,temp);
  }
  __INIT_VAR(data__->REZ,0,retain)
  __INIT_VAR(data__->FIRSTTIME,__BOOL_LITERAL(TRUE),retain)
}

So there is no setting up __IEC_RETAIN_FLAG in COMPLEXRETAIN variable. I suppose there bug with complex retain data type variables, isn't it?

Regards,
Vasilij

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel