Description
The Java frontend synthesises expressions like (signedbv_typet(32)) (integer_typet(50))
, for example due to the bytecode op bipush 50
, for which the parser makes an integer-typed constant for the 50
and then wraps it in a typecast for the bipush
(see https://github.com/diffblue/cbmc/blob/master/src/java_bytecode/java_bytecode_convert_method.cpp#L1416)
Problem is, only simplify_expr
actually understands that construct (at https://github.com/diffblue/cbmc/blob/master/src/util/simplify_expr.cpp#L451); in particular boolbvt::convert_typecast
does not, and for input:
public class test {
public void f() {
int x = 50;
}
}
with command line: cbmc test.class --no-simplify --function test.f --cover location
We get the predictable error:
warning: ignoring typecast
* type: signedbv
* width: 32
* #c_type: signed_int
0: constant
* type: integer
* value: 50
Therefore I say the Java frontend should forcibly simplify that expression immediately upon generating it, rather than hope for optional downstream passes to fix it up.