Fix filling candidate datatypes of JMP operations
authorMario de Sousa <msousa@fe.up.pt>
Sat, 03 Mar 2012 13:07:00 +0000
changeset 462 f7dada0a8952
parent 461 fcbc0927fc96
child 463 fafa9abc166e
Fix filling candidate datatypes of JMP operations
stage3/fill_candidate_datatypes.cc
--- a/stage3/fill_candidate_datatypes.cc	Sat Mar 03 08:51:28 2012 +0000
+++ b/stage3/fill_candidate_datatypes.cc	Sat Mar 03 13:07:00 2012 +0000
@@ -566,6 +566,7 @@
 void *fill_candidate_datatypes_c::visit(duration_c *symbol) {
 	/* TODO: check whether the literal follows the rules specified in section '2.2.3.1 Duration' of the standard! */
 	
+	/* Either of the following two lines is correct. Each of them will have advantages and drawbacks during compiler debugging. Use whichever suits you best... */
 	symbol->candidate_datatypes.push_back(&search_constant_type_c::time_type_name);
 // 	symbol->candidate_datatypes.push_back(symbol->type_name);
 	if (debug) std::cout << "TIME_LITERAL [" << symbol->candidate_datatypes.size() << "]\n";
@@ -813,7 +814,6 @@
 		 */
 		intersect_prev_candidate_datatype_lists(symbol);
 	} else {
-// 		if (symbol->prev_il_instruction.size() > 1) ERROR; /* This assertion is only valid for now. Remove it once flow_control_analysis_c is complete */
 		il_instruction_c fake_prev_il_instruction = *symbol;
 		intersect_prev_candidate_datatype_lists(&fake_prev_il_instruction);
 
@@ -918,11 +918,14 @@
   return NULL;
 }
 
+
 void *fill_candidate_datatypes_c::visit(il_jump_operation_c *symbol) {
   /* recursive call to fill the candidate data types list */
   il_operand = NULL;
   symbol->il_jump_operator->accept(*this);
   il_operand = NULL;
+  /* This object has the same candidate datatypes as the il_jump_operator. */
+  copy_candidate_datatype_list(symbol->il_jump_operator/*from*/, symbol/*to*/);
   return NULL;
 }