Skip to content

Commit af4edae

Browse files
committed
Fixing inheritance issue for java programs.
CBMC was incorrectly stubbing inherited methods. This leads to such methods being treated as non-det. The fix simply prevents CBMC from stubbing methods that are inherited.
1 parent d325431 commit af4edae

Some content is hidden

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

42 files changed

+287
-4
lines changed

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ DIRS = ansi-c \
33
cbmc \
44
cpp \
55
cbmc-java \
6+
cbmc-java-inheritance \
67
goto-analyzer \
78
goto-instrument \
89
goto-instrument-typedef \
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
default: tests.log
2+
3+
test:
4+
@if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
5+
../failed-tests-printer.pl ; \
6+
exit 1 ; \
7+
fi
8+
9+
tests.log: ../test.pl
10+
@if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
11+
../failed-tests-printer.pl ; \
12+
exit 1 ; \
13+
fi
14+
15+
show:
16+
@for dir in *; do \
17+
if [ -d "$$dir" ]; then \
18+
vim -o "$$dir/*.java" "$$dir/*.out"; \
19+
fi; \
20+
done;
21+
22+
clean:
23+
find -name '*.out' -execdir $(RM) '{}' \;
24+
find -name '*.gb' -execdir $(RM) '{}' \;
25+
$(RM) tests.log
26+
27+
%.class: %.java ../../src/org.cprover.jar
28+
javac -g -cp ../../src/org.cprover.jar:. $<
29+
30+
nondet_java_files := $(shell find . -name "Nondet*.java")
31+
nondet_class_files := $(patsubst %.java, %.class, $(nondet_java_files))
32+
33+
.PHONY: nondet-class-files
34+
nondet-class-files: $(nondet_class_files)
35+
36+
.PHONY: clean-nondet-class-files
37+
clean-nondet-class-files:
38+
-rm $(nondet_class_files)
235 Bytes
Binary file not shown.
164 Bytes
Binary file not shown.
556 Bytes
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
test.class
3+
--function test.check
4+
^EXIT=0$
5+
^SIGNAL=0$
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class A
2+
{
3+
public int toInt()
4+
{
5+
return 12345;
6+
}
7+
}
8+
9+
class B extends A
10+
{
11+
}
12+
13+
class test
14+
{
15+
void check()
16+
{
17+
B b=new B();
18+
assert(b.toInt()==12345);
19+
}
20+
}
235 Bytes
Binary file not shown.
510 Bytes
Binary file not shown.
283 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)