Skip to content

Commit f6a0299

Browse files
author
Enrico Steffinlongo
committed
Add lookup for non-lowered exprt in get_identifier
This fixes a problem with looking up the value of an assertion, which resulted in the properties not being properly updated after the property decider had run. This was because assertion expressions are given a handle symbol that is queried to the solver. The decision procedure was trying to resolve the handle from a lowered expression and not the original that was saved in the map not receiving the correct symbol back.
1 parent 892c792 commit f6a0299

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,24 @@ static optionalt<smt_termt> get_identifier(
351351
&expression_identifiers,
352352
const namespacet &ns)
353353
{
354-
const exprt lowered_expr = lower_enum(expr, ns);
355-
const auto handle_find_result =
356-
expression_handle_identifiers.find(lowered_expr);
354+
// Lookup the non-lowered form first.
355+
const auto handle_find_result = expression_handle_identifiers.find(expr);
357356
if(handle_find_result != expression_handle_identifiers.cend())
358357
return handle_find_result->second;
359-
const auto expr_find_result = expression_identifiers.find(lowered_expr);
358+
const auto expr_find_result = expression_identifiers.find(expr);
360359
if(expr_find_result != expression_identifiers.cend())
361360
return expr_find_result->second;
361+
362+
// If that didn't yield any results, then try the lowered form.
363+
const exprt lowered_expr = lower_enum(expr, ns);
364+
const auto lowered_handle_find_result =
365+
expression_handle_identifiers.find(lowered_expr);
366+
if(lowered_handle_find_result != expression_handle_identifiers.cend())
367+
return lowered_handle_find_result->second;
368+
const auto lowered_expr_find_result =
369+
expression_identifiers.find(lowered_expr);
370+
if(lowered_expr_find_result != expression_identifiers.cend())
371+
return lowered_expr_find_result->second;
362372
return {};
363373
}
364374

0 commit comments

Comments
 (0)