From 9daf965a9959287769117b06917b2d7adf1783cd Mon Sep 17 00:00:00 2001 From: Xuejun Yang Date: Thu, 2 Jun 2011 23:05:05 -0600 Subject: [PATCH] bug fixing for the reducer --- src/Reducer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Reducer.cpp b/src/Reducer.cpp index eaedf8bb5..7d0251eba 100644 --- a/src/Reducer.cpp +++ b/src/Reducer.cpp @@ -106,6 +106,22 @@ Reducer::configure(void) StringUtils::chop(line); // make sure the focus var is marked as used var const Variable* key = VariableSelector::find_var_by_name(line); + if (key == NULL) { + // it's possible an array variable that is not specifically itemized in the + // program that is the focus var. we manually itemize it here + vector strs; + StringUtils::split_string(line, strs, "[]"); + const Variable* ary = VariableSelector::find_var_by_name(strs[0]); + assert(ary && ary->isArray); + const ArrayVariable* av = (const ArrayVariable*)ary; + vector indices; + for (size_t k=0; kget_dimension(); k++) { + assert(k + 1 < strs.size()); + indices.push_back(StringUtils::str2int(strs[k+1])); + } + av->itemize(indices); + } + key = VariableSelector::find_var_by_name(line); assert(key); monitored_var = key; used_vars.push_back(key->get_named_var());