Skip to content

Fix Java integers when --no-simplify is set #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
7 changes: 7 additions & 0 deletions regression/cbmc-java/integer_without_simplify1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
test.class
--no-simplify --function test.f --cover location
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
10 changes: 10 additions & 0 deletions regression/cbmc-java/integer_without_simplify1/test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

public class test {

public void f() {

int x = 50;

}

}
6 changes: 5 additions & 1 deletion src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Author: Daniel Kroening, [email protected]
#include <util/prefix.h>
#include <util/arith_tools.h>
#include <util/ieee_float.h>
#include <util/simplify_expr.h>

#include <linking/zero_initializer.h>

Expand Down Expand Up @@ -1416,7 +1417,10 @@ codet java_bytecode_convert_methodt::convert_instructions(
else if(statement==patternt("?ipush"))
{
assert(results.size()==1);
results[0]=typecast_exprt(arg0, java_int_type());
mp_integer int_value;
bool ret=to_integer(to_constant_expr(arg0), int_value);
INVARIANT(!ret, "?ipush argument should be an integer");
results[0]=from_integer(int_value, java_int_type());
}
else if(statement==patternt("if_?cmp??"))
{
Expand Down