From 14e7c92f1468ffc72d08207ead27f9079b68e16c Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Thu, 7 Mar 2019 11:09:02 +0100
Subject: [PATCH] pac: fix bug in setting of target variable

---
 src/ExprNode.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index fc1ecdeb..bf684c4d 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -5567,7 +5567,7 @@ BinaryOpNode::getPacEC(BinaryOpNode *bopn, int lhs_symb_id, int lhs_orig_symb_id
       for (const auto & it : endogs)
         {
           int id = it.first;
-          bool istarget = false;
+          bool istarget = true;
           while (datatree.symbol_table.isAuxiliaryVariable(id))
             try
               {
@@ -5578,7 +5578,7 @@ BinaryOpNode::getPacEC(BinaryOpNode *bopn, int lhs_symb_id, int lhs_orig_symb_id
                 break;
               }
           if (id == lhs_symb_id || id == lhs_orig_symb_id)
-            istarget = true;
+            istarget = false;
           symb_ids.push_back({it.first, istarget});
         }
       ec_params_and_vars = make_pair(optim_param_symb_id, symb_ids);
-- 
GitLab