Ensure that unary ops aux vars are never created when there is a lead
The transformation would be incorrect because of the expectation operator. There was already a safety check, but it was not entirely correct. For example, if “exp(y)” was appearing before “exp(y(+1))”, the check would not catch the problem, because it happened after the substitution table had been filled. So we now do the check before filling that table.issue#70
parent
3941278832
commit
9b9c5beb5c
|
@ -3599,12 +3599,6 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
|
|||
if (it == nodes.end())
|
||||
return buildSimilarUnaryOpNode(argsubst, datatree);
|
||||
|
||||
if (arg->maxLead() > 0)
|
||||
{
|
||||
cerr << "Cannot substitute unary operations that contain leads" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
string unary_op;
|
||||
switch (op_code)
|
||||
{
|
||||
|
@ -3682,6 +3676,16 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
|
|||
for (auto rit = it->second.rbegin(); rit != it->second.rend(); ++rit)
|
||||
if (rit == it->second.rbegin())
|
||||
{
|
||||
/* Verify that we’re not operating on a node with leads, since the
|
||||
transformation does take into account the expectation operator. We only
|
||||
need to do this for the first iteration of the loop, because we’re
|
||||
going from leads to lags. */
|
||||
if (rit->second->maxLead() > 0)
|
||||
{
|
||||
cerr << "Cannot substitute unary operations that contain leads" << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int symb_id;
|
||||
auto *vn = dynamic_cast<VariableNode *>(argsubst);
|
||||
if (vn == nullptr)
|
||||
|
|
Loading…
Reference in New Issue