From 0d31c7a8936fc1c553fdae967132736425709c34 Mon Sep 17 00:00:00 2001
From: houtanb <houtan@dynare.org>
Date: Fri, 23 Jun 2017 14:51:14 +0200
Subject: [PATCH] preprocessor: substitute adl and diff before cloning original
 model

---
 ModFile.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ModFile.cc b/ModFile.cc
index b011a195..304e4df1 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -335,6 +335,8 @@ void
 ModFile::transformPass(bool nostrict, bool compute_xrefs)
 {
   // Save the original model (must be done before any model transformations by preprocessor)
+  // - except adl and diff which we always want expanded
+  dynamic_model.substituteAdlAndDiff();
   dynamic_model.cloneDynamic(original_model);
 
   if (nostrict)
@@ -349,8 +351,6 @@ ModFile::transformPass(bool nostrict, bool compute_xrefs)
     }
 
   // Var Model
-  dynamic_model.substituteAdlAndDiff();
-
   map<string, pair<SymbolList, int> > var_model_info;
   for (vector<Statement *>::const_iterator it = statements.begin();
        it != statements.end(); it++)
-- 
GitLab