Skip to content

Commit a71dfb5

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#951 from mgudemann/fix/bytecode_args_write_from_stack
Fix/bytecode args write from stack
2 parents 1b58ff9 + 0ce085f commit a71dfb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+733
-10
lines changed

regression/cbmc-java/LocalVarTable5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test.class
44
dead anonlocal::1i
55
dead anonlocal::2i
66
dead anonlocal::3a
7-
dead new_tmp0
7+
dead new_tmp[0-9]+
88
^EXIT=0$
99
^SIGNAL=0$
1010
--

regression/cbmc-java/destructor1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Break.class
55
^SIGNAL=0$
66
dead i;
77
--
8-
GOTO 10
8+
GOTO 11
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
603 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var1 s = new stack_var1();
4+
int n = s.f(1);
5+
assert(n==0);
6+
}
7+
}
205 Bytes
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.class public stack_var1
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f(I)I
11+
.limit stack 2
12+
.limit locals 2
13+
14+
;; copy of arg on stack
15+
iload_1
16+
;; increment arg
17+
iinc 1 1
18+
;; incremented copy on stack
19+
iload_1
20+
isub
21+
ireturn
22+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
602 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var10 s = new stack_var10();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
223 Bytes
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.class public stack_var10
2+
.super java/lang/Object
3+
4+
.field private static n I
5+
6+
.method public <init>()V
7+
.limit stack 5
8+
aload_0
9+
invokenonvirtual java/lang/Object/<init>()V
10+
return
11+
.end method
12+
13+
.method public f()I
14+
.limit stack 8
15+
.limit locals 5
16+
17+
iconst_1
18+
istore_1
19+
iconst_0
20+
istore_2
21+
;; lvar1 is 1, lvar2 is 0
22+
iload_1
23+
iload_2
24+
;; on stack 1, 0
25+
istore_1
26+
;; store 0 into lvar1
27+
ireturn
28+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
602 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var11 s = new stack_var11();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
249 Bytes
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.class public stack_var11
2+
.super java/lang/Object
3+
4+
.field private arr [I
5+
6+
.method public <init>()V
7+
.limit stack 5
8+
aload_0
9+
invokenonvirtual java/lang/Object/<init>()V
10+
aload_0
11+
iconst_2
12+
newarray int
13+
putfield stack_var11/arr [I
14+
return
15+
.end method
16+
17+
.method public f()I
18+
.limit stack 8
19+
.limit locals 5
20+
aload_0
21+
getfield stack_var11/arr [I
22+
iconst_0
23+
iaload ;; put arr[0] on stack (currently 0)
24+
aload_0
25+
getfield stack_var11/arr [I
26+
iconst_0
27+
iconst_1
28+
iastore ;; store 1 in arr[0],
29+
;; value on stack should not be touched
30+
ireturn
31+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
603 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var2 s = new stack_var2();
4+
int n = s.f(1);
5+
assert(n==0);
6+
}
7+
}
206 Bytes
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.class public stack_var2
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f(I)I
11+
.limit stack 3
12+
.limit locals 2
13+
14+
;; push local var1
15+
iload_1
16+
;; duplicate
17+
dup
18+
;; increment local var1
19+
iinc 1 1
20+
;; push local var1
21+
iload_1
22+
isub
23+
;; incremented copy on stack
24+
ireturn
25+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
601 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var3 s = new stack_var3();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
210 Bytes
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.class public stack_var3
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f()I
11+
.limit stack 5
12+
.limit locals 3
13+
14+
;; 1->var1
15+
;; 0->var2
16+
iconst_1
17+
istore_1
18+
iconst_0
19+
istore_2
20+
;; push local var2 / var1
21+
iload_2
22+
iload_1
23+
;; dup var1
24+
dup_x1
25+
;; sub one from var1
26+
iinc 1 -1
27+
;; pop first var1
28+
pop
29+
;; sub
30+
isub
31+
;; incremented copy on stack
32+
ireturn
33+
.end method
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
601 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var4 s = new stack_var4();
4+
int n = s.f();
5+
assert(n==0);
6+
}
7+
}
214 Bytes
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.class public stack_var4
2+
.super java/lang/Object
3+
4+
.method public <init>()V
5+
aload_0
6+
invokenonvirtual java/lang/Object/<init>()V
7+
return
8+
.end method
9+
10+
.method public f()I
11+
.limit stack 5
12+
.limit locals 4
13+
14+
;; 0->var1
15+
;; 1->var2
16+
;; 2->var3
17+
iconst_0
18+
istore_1
19+
iconst_1
20+
istore_2
21+
iconst_2
22+
istore_3
23+
24+
;; push local var3 / var2 / var1
25+
iload_3
26+
iload_2
27+
iload_1
28+
;; push var1 in front of var3
29+
dup_x2
30+
;; add one to local var 1
31+
iinc 1 1
32+
pop
33+
pop
34+
pop
35+
;; incremented copy on stack
36+
ireturn
37+
.end method
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
stack_test.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^.*assertion at file stack_test.java line 5 function.*: SUCCESS
7+
$
8+
^VERIFICATION SUCCESSFUL$
9+
--
10+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This regression test is created from the .j file with the jasmin assembler.
2+
https://github.com/Sable/jasmin
3+
4+
On Ubuntu, it is available as jasmin-sable. To convert a .j file, it is
5+
sufficient to do
6+
7+
> jasmin $FILE.j
8+
9+
and it will create the corresponding $FILE.class file.
602 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class stack_test {
2+
public static void main(String[] args) {
3+
stack_var5 s = new stack_var5();
4+
int n = s.f();
5+
assert(n==1);
6+
}
7+
}
209 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)