From 7f59b8074c00aaa398284d5172949e9165c8e1ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr>
Date: Wed, 20 Oct 2010 11:39:09 +0200
Subject: [PATCH] Preprocessor: fix possible bug in histval (need to limit
 search of aux vars to aux vars for lagged vars, otherwise we could have a
 wrong match with some other kind)

---
 preprocessor/SymbolTable.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/preprocessor/SymbolTable.cc b/preprocessor/SymbolTable.cc
index 071db40d90..7043de839d 100644
--- a/preprocessor/SymbolTable.cc
+++ b/preprocessor/SymbolTable.cc
@@ -371,7 +371,8 @@ int
 SymbolTable::searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const
 {
   for (int i=0; i < aux_vars.size();++i)
-    if ((aux_vars[i].get_orig_symb_id() == orig_symb_id) && (aux_vars[i].get_orig_lead_lag() == orig_lead_lag))
+    if ((aux_vars[i].get_type() == avEndoLag || aux_vars[i].get_type() == avExoLag)
+        && aux_vars[i].get_orig_symb_id() == orig_symb_id && aux_vars[i].get_orig_lead_lag() == orig_lead_lag)
       return aux_vars[i].get_symb_id();
   return -1;
 }
-- 
GitLab