Skip to content

Commit e0b4515

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#1016 from diffblue/smowton/fix/java_integers_without_simplify
Fix Java integers when --no-simplify is set
2 parents ed15077 + e2e2360 commit e0b4515

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
test.class
3+
--no-simplify --function test.f --cover location
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
public class test {
3+
4+
public void f() {
5+
6+
int x = 50;
7+
8+
}
9+
10+
}

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Author: Daniel Kroening, [email protected]
1919
#include <util/prefix.h>
2020
#include <util/arith_tools.h>
2121
#include <util/ieee_float.h>
22+
#include <util/simplify_expr.h>
2223

2324
#include <linking/zero_initializer.h>
2425

@@ -1437,7 +1438,10 @@ codet java_bytecode_convert_methodt::convert_instructions(
14371438
else if(statement==patternt("?ipush"))
14381439
{
14391440
assert(results.size()==1);
1440-
results[0]=typecast_exprt(arg0, java_int_type());
1441+
mp_integer int_value;
1442+
bool ret=to_integer(to_constant_expr(arg0), int_value);
1443+
INVARIANT(!ret, "?ipush argument should be an integer");
1444+
results[0]=from_integer(int_value, java_int_type());
14411445
}
14421446
else if(statement==patternt("if_?cmp??"))
14431447
{

0 commit comments

Comments
 (0)