# HG changeset patch # User laurent # Date 1258537995 -3600 # Node ID 136d6ae7074554ed68cfad66ca0adb50b9087f2a # Parent 15c98c40f6f46d7d4e8698f8d4d8956929b6b23a Bug with using non explicit literals as standard library functions input parameters fixed diff -r 15c98c40f6f4 -r 136d6ae70745 stage4/generate_c/generate_c_il.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("("); diff -r 15c98c40f6f4 -r 136d6ae70745 stage4/generate_c/generate_c_st.cc --- 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);