From de9e897a59e82f0d82cd116e3283bd17ec46e19d Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Fri, 2 Mar 2018 18:39:38 +0100 Subject: [PATCH] fix bug when the argument of the diff operator is not a variable --- src/ExprNode.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ExprNode.cc b/src/ExprNode.cc index fa0cdf42..f6393c7d 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -2954,7 +2954,10 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table, for (int i = last_arg_max_lag; i > rit->first; i--) { if (vn == NULL) - symb_id = datatree.symbol_table.addDiffAuxiliaryVar(new_aux_var->idx, new_aux_var); + if (i == last_arg_max_lag) + symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst); + else + symb_id = datatree.symbol_table.addDiffAuxiliaryVar(new_aux_var->idx, new_aux_var); else if (i == last_arg_max_lag) symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst, -- GitLab