From a73b0d911a6ac6dc4628aca1cd614732d639f555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 10 Dec 2021 12:46:11 +0100 Subject: [PATCH] Fix logic of include_eqs in the presence of [static]/[dynamic] equations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a model with [static]/[dynamic] equations, if the user was using include_eqs with a list of equations that does *not* contain equations marked [static]/[dynamic], then the call to ModelTree::includeExcludeEquations(…, static_equations=true) would have an empty list of equation tags (as stored in tag_eqns). The right behaviour in this case is to exclude all static equations. However, the code would exclude none, and this would disrupt the equilibrium between [static] and [dynamic] equations (since all [dynamic] equations were excluded by the other call to the same method). The fix consists in removing the shortcut that returns from the method if tag_eqns is empty. --- src/ModelTree.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ModelTree.cc b/src/ModelTree.cc index da71df01..3a7f98ba 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1566,9 +1566,6 @@ ModelTree::includeExcludeEquations(set<pair<string, string>> &eqs, bool exclude_ else ++it; - if (tag_eqns.empty()) - return excluded_vars; - set<int> eqns; if (exclude_eqs) eqns = tag_eqns; -- GitLab