Missing variable reassignment in generated cpp code
Expected: different values assigned to the variable c
two times.
Actual: c
gets value assigned only first time.
Model:
component Add{
ports
in Q(0 : 10) a,
out Q(0 : 20) c;
implementation Math{
Q b = 42 + a;
c = 1 + b;
b = 43;
c = 1 + b;
}
}
Generated code:
#ifndef ADD
#define ADD
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include "armadillo"
using namespace arma;
class add{
public:
double a;
double c;
void init()
{
}
void execute()
{
double b = 2+a;
c = 1+b;
b = 3;
}
};
#endif
Missing c = 1 + b;
as the last statement in the execute()
block.
Problem occurs only when c
has two identical assignments.