Skip to content

Commit f4fbcc7

Browse files
author
owen-jones-diffblue
authored
Merge pull request #3657 from owen-jones-diffblue/fix-string-initialiser-type
Fix String initialiser type when java.lang.String is a stub
2 parents 04e7ff7 + 0d96b0d commit f4fbcc7

File tree

9 files changed

+49
-1
lines changed

9 files changed

+49
-1
lines changed

jbmc/regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ add_subdirectory(jbmc)
77
add_subdirectory(strings-smoke-tests)
88
add_subdirectory(jbmc-strings)
99
add_subdirectory(jdiff)
10+
add_subdirectory(janalyzer)
1011
add_subdirectory(janalyzer-taint)
1112
add_subdirectory(jbmc-concurrency)
1213
add_subdirectory(jbmc-inheritance)

jbmc/regression/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# For the best possible utilisation of multiple cores when
22
# running tests in parallel, it is important that these directories are
33
# listed with decreasing runtimes (i.e. longest running at the top)
4-
DIRS = janalyzer-taint \
4+
DIRS = janalyzer \
5+
janalyzer-taint \
56
jbmc \
67
jbmc-concurrency \
78
jbmc-inheritance \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:janalyzer>"
3+
)

jbmc/regression/janalyzer/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
default: tests.log
2+
3+
include ../../src/config.inc
4+
5+
test:
6+
@../$(CPROVER_DIR)/regression/test.pl -p -c ../../../src/janalyzer/janalyzer
7+
8+
tests.log: ../$(CPROVER_DIR)/regression/test.pl
9+
@../$(CPROVER_DIR)/regression/test.pl -p -c ../../../src/janalyzer/janalyzer
10+
11+
show:
12+
@for dir in *; do \
13+
if [ -d "$$dir" ]; then \
14+
vim -o "$$dir/*.java" "$$dir/*.out"; \
15+
fi; \
16+
done;
17+
18+
clean:
19+
find -name '*.out' -execdir $(RM) '{}' \;
20+
find -name '*.gb' -execdir $(RM) '{}' \;
21+
$(RM) tests.log
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Basic1
2+
{
3+
public static void main(String[] args) {
4+
String s = "Hello ";
5+
s += "World!";
6+
if(s.equals("Hello World!"))
7+
System.out.printf("Hello World!");
8+
}
9+
};
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
Basic1.class
3+
--location-sensitive --constants --show
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
Hello_20 = \{ \.@class_identifier="java::java\.lang\.String" \};
7+
java::java\.lang\.String\.Literal\.Hello_20=\{ \.@class_identifier="java::java\.lang\.String" \}
8+
--
9+
^warning: ignoring

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ janalyzer_parse_optionst::janalyzer_parse_optionst(int argc, const char **argv)
6666

6767
void janalyzer_parse_optionst::register_languages()
6868
{
69+
// Need ansi C language for __CPROVER_rounding_mode
70+
register_language(new_ansi_c_language);
6971
register_language(new_java_bytecode_language);
7072
}
7173

jbmc/src/java_bytecode/java_string_literals.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ symbol_exprt get_or_create_string_literal_symbol(
204204
// Case where java.lang.String was stubbed, and so directly defines
205205
// @class_identifier
206206
new_symbol.value = jlo_init;
207+
new_symbol.value.type() = string_type;
207208
}
208209

209210
bool add_failed = symbol_table.add(new_symbol);

0 commit comments

Comments
 (0)