summaryrefslogtreecommitdiff
path: root/src/theory/strings/sequences_rewriter.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-06-28 08:34:44 -0500
committerGitHub <noreply@github.com>2020-06-28 08:34:44 -0500
commit46591b1c92fc9ecd4a0997242030a1a48166301b (patch)
tree83ef7b9262e31957bebd685e3be0c943f8c01d64 /src/theory/strings/sequences_rewriter.cpp
parentcb68fa0f7b096bf086a7c7189e40805253ef1acf (diff)
Fix non-termination issues in simpleRegExpConsume (#4667)
There were two issues related to RE in bodies of re.* that accepted the empty string that led to non-termination in the rewriter for regular expressions. This also improves trace messages for simpleRegExpConsume. Fixes #4662.
Diffstat (limited to 'src/theory/strings/sequences_rewriter.cpp')
-rw-r--r--src/theory/strings/sequences_rewriter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/theory/strings/sequences_rewriter.cpp b/src/theory/strings/sequences_rewriter.cpp
index 9df03f32c..20b892d0f 100644
--- a/src/theory/strings/sequences_rewriter.cpp
+++ b/src/theory/strings/sequences_rewriter.cpp
@@ -1315,9 +1315,13 @@ Node SequencesRewriter::rewriteMembership(TNode node)
}
else
{
+ Node prev = retNode;
retNode = nm->mkNode(
STRING_IN_REGEXP, utils::mkConcat(mchildren, stype), r);
- success = true;
+ // Iterate again if the node changed. It may not have changed if
+ // nothing was consumed from mchildren (e.g. if the body of the
+ // re.* accepts the empty string.
+ success = (retNode != prev);
}
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback