# HG changeset patch # User mjsousa # Date 1377116090 -3600 # Node ID e0184feaebd2420221e988f1bb32a9298b863378 # Parent 149398f525a7ff6c1aa3a2dc605c2b059f1b4d04 Fix datatype analyses of S and R IL operators. diff -r 149398f525a7 -r e0184feaebd2 stage3/fill_candidate_datatypes.cc --- a/stage3/fill_candidate_datatypes.cc Wed Aug 21 16:08:50 2013 +0100 +++ b/stage3/fill_candidate_datatypes.cc Wed Aug 21 21:14:50 2013 +0100 @@ -604,6 +604,7 @@ if (NULL == prev_il_instruction) return NULL; if (NULL == il_operand) return NULL; + /* Try the Set/Reset semantics */ for (unsigned int i = 0; i < prev_il_instruction->candidate_datatypes.size(); i++) { for(unsigned int j = 0; j < il_operand->candidate_datatypes.size(); j++) { prev_instruction_type = prev_il_instruction->candidate_datatypes[i]; @@ -618,15 +619,15 @@ } /* if the appropriate semantics is not a Set/Reset of a boolean variable, the we try for the FB invocation! */ - if (symbol->candidate_datatypes.size() == 0) + if (symbol->candidate_datatypes.size() == 0) { handle_implicit_il_fb_call(symbol, operator_str, called_fb_declaration); - - /* If it is also not a valid FB call, make sure the candidate_datatypes is empty (handle_implicit_il_fb_call may leave it non-empty!!) */ - /* From here on out, all later code will consider the symbol->called_fb_declaration being NULL as an indication that this operator must use the - * Set/Reset semantics, so we must also guarantee that the remainder of the state of this symbol is compatible with that assumption! - */ - if (NULL == called_fb_declaration) - symbol->candidate_datatypes.clear(); + /* If it is also not a valid FB call, make sure the candidate_datatypes is empty (handle_implicit_il_fb_call may leave it non-empty!!) */ + /* From here on out, all later code will consider the symbol->called_fb_declaration being NULL as an indication that this operator must use the + * Set/Reset semantics, so we must also guarantee that the remainder of the state of this symbol is compatible with that assumption! + */ + if (NULL == called_fb_declaration) + symbol->candidate_datatypes.clear(); + } if (debug) std::cout << operator_str << " [" << prev_il_instruction->candidate_datatypes.size() << "," << il_operand->candidate_datatypes.size() << "] ==> " << symbol->candidate_datatypes.size() << " result.\n"; return NULL;