Skip to content

Commit a4e9328

Browse files
Make unsupported case notModelled instead of using assume
Under-approximated models can lead to spurious UNSAT results in JBMC; however, we can mark over-approximated cases as notModelled and JBMC will detect them and give a warning that behaviour is over-approximating when reporting SAT.
1 parent 7973361 commit a4e9328

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/java/lang/String.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,8 +2996,7 @@ public String replaceAll(String regex, String replacement)
29962996
{
29972997
// return Pattern.compile(regex).matcher(this).replaceAll(replacement);
29982998
// DIFFBLUE MODELS LIBRARY: we assume the expression is just a string literal
2999-
CProver.assume(
3000-
regex.indexOf('[') == -1 &&
2999+
if (regex.indexOf('[') == -1 &&
30013000
regex.indexOf(']') == -1 &&
30023001
regex.indexOf('.') == -1 &&
30033002
regex.indexOf('\\') == -1 &&
@@ -3010,8 +3009,12 @@ public String replaceAll(String regex, String replacement)
30103009
regex.indexOf('}') == -1 &&
30113010
regex.indexOf('|') == -1 &&
30123011
regex.indexOf('(') == -1 &&
3013-
regex.indexOf(')') == -1);
3014-
return replace(regex, replacement);
3012+
regex.indexOf(')') == -1) {
3013+
return replace(regex, replacement);
3014+
} else {
3015+
CProver.notModelled();
3016+
return CProver.nondetWithNullForNotModelled();
3017+
}
30153018
}
30163019

30173020
/**

0 commit comments

Comments
 (0)