Bug with using non explicit literals as standard library functions input parameters fixed
authorlaurent
Wed, 18 Nov 2009 10:53:15 +0100
changeset 216 136d6ae70745
parent 215 15c98c40f6f4
child 217 f5dfadf5de54
Bug with using non explicit literals as standard library functions input parameters fixed
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_il.cc	Mon Nov 02 17:41:56 2009 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Wed Nov 18 10:53:15 2009 +0100
@@ -712,7 +712,14 @@
           param_value = (symbol_c *)param_type->accept(*type_initial_value_c::instance());
         }
         if (param_value == NULL) ERROR;
-        if (search_base_type.type_is_subrange(param_type)) {
+        if (search_expression_type->is_literal_integer_type(param_type) ||
+			search_expression_type->is_literal_real_type(param_type)) {
+			if (function_type_suffix == NULL) ERROR;
+			function_type_suffix->accept(*this);
+		}
+		else
+			param_type->accept(*this);
+		if (search_base_type.type_is_subrange(param_type)) {
           s4o.print("__CHECK_");
           param_type->accept(*this);
           s4o.print("(");
@@ -1043,7 +1050,14 @@
           param_value = (symbol_c *)param_type->accept(*type_initial_value_c::instance());
         }
         if (param_value == NULL) ERROR;
-        if (search_base_type.type_is_subrange(param_type)) {
+        if (search_expression_type->is_literal_integer_type(param_type) ||
+			search_expression_type->is_literal_real_type(param_type)) {
+			if (function_type_suffix == NULL) ERROR;
+			function_type_suffix->accept(*this);
+		}
+		else
+			param_type->accept(*this);
+		if (search_base_type.type_is_subrange(param_type)) {
           s4o.print("__CHECK_");
           param_type->accept(*this);
           s4o.print("(");
--- a/stage4/generate_c/generate_c_st.cc	Mon Nov 02 17:41:56 2009 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Wed Nov 18 10:53:15 2009 +0100
@@ -506,6 +506,15 @@
           param_value = (symbol_c *)param_type->accept(*type_initial_value_c::instance());
         }
         if (param_value == NULL) ERROR;
+        s4o.print("(");
+        if (search_expression_type->is_literal_integer_type(param_type) ||
+            search_expression_type->is_literal_real_type(param_type)) {
+        	if (function_type_suffix == NULL) ERROR;
+        	function_type_suffix->accept(*this);
+        }
+        else
+        	param_type->accept(*this);
+        s4o.print(")");
         if (search_base_type.type_is_subrange(param_type)) {
           s4o.print("__CHECK_");
           param_type->accept(*this);