Skip to content

Commit dead022

Browse files
romainbrenguierJoel Allred
authored and
Joel Allred
committed
Corrected type problem for the function Character.forDigit:(II)C
1 parent da849ee commit dead022

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/java_bytecode/character_refine_preprocess.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Function: character_refine_preprocesst::convert_for_digit
306306
target - a position in a goto program
307307
308308
Purpose: Converts function call to an assignment of an expression
309-
corresponding to the java method Character.forDigit:(II)I
309+
corresponding to the java method Character.forDigit:(II)C
310310
311311
TODO: For now the radix argument is ignored
312312
@@ -319,11 +319,12 @@ codet character_refine_preprocesst::convert_for_digit(conversion_inputt &target)
319319
const exprt &digit=function_call.arguments()[0];
320320
const exprt &result=function_call.lhs();
321321
const typet &type=result.type();
322+
typecast_exprt casted_digit(digit, type);
322323

323324
exprt d10=from_integer(10, type);
324-
binary_relation_exprt small(digit, ID_le, d10);
325-
plus_exprt value1(digit, from_integer('0', type));
326-
minus_exprt value2(plus_exprt(digit, from_integer('a', digit.type())), d10);
325+
binary_relation_exprt small(casted_digit, ID_le, d10);
326+
plus_exprt value1(casted_digit, from_integer('0', type));
327+
plus_exprt value2(minus_exprt(casted_digit, d10), from_integer('a', type));
327328
return code_assignt(result, if_exprt(small, value1, value2));
328329
}
329330

0 commit comments

Comments
 (0)